Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish as NPM package #28

Closed
mourner opened this issue Feb 26, 2015 · 6 comments
Closed

Publish as NPM package #28

mourner opened this issue Feb 26, 2015 · 6 comments
Assignees

Comments

@mourner
Copy link

mourner commented Feb 26, 2015

NPM is becoming the de-facto standard repository of JS modules, both browser and server. So it would be nice to have this published there.

@krawaller
Copy link

+1

@badsyntax
Copy link
Contributor

+1, would be useful, needs some UMD love.

@padolsey padolsey self-assigned this Apr 23, 2015
@padolsey
Copy link
Owner

Agreed, just made 0.4.3 available on npm: https://www.npmjs.com/package/findandreplacedomtext

@mourner
Copy link
Author

mourner commented Apr 28, 2015

Awesome, thanks!

@badsyntax
Copy link
Contributor

Can I suggest something along the lines of...

(function (root, factory) {
    if (typeof module === 'object' && module.exports) {
        // Node/CommonJS
        module.exports = factory();
    } else if (typeof define === 'function' && define.amd) {
        // AMD. Register as an anonymous module.
        define(factory);
    } else {
        // Browser globals
        root.findAndReplaceDOMText = factory();
    }
}(this, function factory() {

    function exposed() {
    }

    return exposed;
}));

.. along with a change to package.json to specify main entrypoint.

@mourner
Copy link
Author

mourner commented Apr 28, 2015

@padolsey yeah, one gripe remaining — it's only exported as a browser global, which makes it impossible to use with build systems like Browserify and Webpack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants