npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nw-me

v1.0.3

Published

A very simple WYSIWYG editor for static HTML pages that can be saved locally and deployed to a static host such as S3

Downloads

13

Readme

nw-me

NodeWebkit (nwjs) meets MediumEditor.

A very simple WYSIWYG editor for static HTML pages that can be saved locally and deployed to a static host such as S3. The inline HTML editing is provided by MediumEditor and the file management is handled in node.js by way of nwjs

DOM manipulation is handled by jquery in the browser and Cheerio in node.js.

Use Case

There seems to be a CMS out there for just about everything. However, I couldn't find one that would check these boxes:

  • Free to use and 100% Open Source
  • Editable directly on the page (full WYSIWYG)
  • Start with a set of static interlinked HTML files (built on any client side framework and with any content)
  • One-click staging/publish as completely static HTML files to be hosted on S3 or similar.

Install

npm i -S nw-me

Usage

Create the folder structure and index.js:

var nwme = require('nw-me');
nwme.init();

Drop your static HTML files and any associated scripts and assets into the "original" folder.

For any HTML element that you want to make editable, specify a data attribute as follows:

<h1 data-editable="header.title">Welcome to NW-ME</h1>

The variable name (e.g. header.title) should be unique (unless the content is intended to be repeated). This can be any element with text content (including tags such as <b>, <i> <a> etc). See MediumEditor Documentation for more information.

Running the Application

Run npm init and configure your package.json in accordance with the NWJS documentation.

Launch the NWJS application

Switch between "Edit Mode" and "View Mode" to edit content or navigate between HTML pages. Changes are saved when you toggle back to "View Mode".

Deployment

Deployment to static hosts such as S3 can be handled using a module with a ".deploy" method with the following signature:

this.deploy = function (folder, type, callback) { ...

folder: the file path of the 'deploy' folder that is to be copied to S3. type: either 'staging' or 'production' depending on which option the user selected. callback: the method to call when deployment is complete. If a "url" property is passed back, this URL will be run from shell (launched in the default browser).

callback({
    success: true,
    url: 'http://my-site.s3-website-us-east-1.amazonaws.com/' + type + '/'
});

And example S3 deployment module is included (commented out) in the "index.js" file.

Behind the scenes

  1. If the editing folder is empty, all files from original are copied to edit
  2. Medium-Editor scripts and nw-js scripts are copied to the editing folder
  3. Script tags are added to the head and body elements of all your .html files
  4. Any edits made in the tool are saved by modifying the HTML file directly (not from the Browser DOM which may have changed via script).
  5. For deployment as static files, all files from original are copied to deploy; html files from edit are copied to deploy with all temporary data tags and scripts removed.

License

MIT