Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request does two things:
pureknob
into a UMD definition.package.json
fileUMD definition allows us to avoid polluting global namespace
The demo still works with no changes to the html, and
pure-knob
can still be used the way it was before. i.e. If inserted as a script tag in an html file, a variablepureknob
will get added to the global scope.In addition, the module definition allows it to be imported as a node, commonjs, or amd module, as in
or if imported as a bundle by parcel, webpack, browserify, etc, we can even import it into the bundle like a es6 module.
Publishable to npm repository
The
package.json
file definespure-knob
as a node package, which can be published to the node repository usingnpm-publish
(see https://docs.npmjs.com/misc/developers and https://docs.npmjs.com/cli/publish). That way, developers can include it in their projects simply withnpm install pure-knob
, and then import it into their code withor
"pure-knob" without a path or
.js
extension indicates to the bundler that "pure-knob" is a npm package and will look for it in thenode_modules
folder for the active project.I could publish it from my fork, but I would rather that @andrepxx publish the official
pure-knob
node package.@andrepxx let me know if you need any more clarification about how to publish the "pure-knob" module to npm. This will make it available to many more developers!