CapMousse / include.js

A tiny but heavy on-demand async javascript/css loader
http://capmousse.github.io/include.js/
MIT License
146 stars 22 forks source link

NPM package? #19

Open nkovacic opened 7 years ago

nkovacic commented 7 years ago

I could not find this loader on npm? Would be very useful if it was uploaded on it.

CapMousse commented 7 years ago

As include.js does not support node module loading, I don't think it's worth putting it on NPM. But maybe i'm wrong ! Any idea ?

nkovacic commented 7 years ago

I wanted to you use it for client side external library lazy loading (Youtube api, google maps,...). Because of continous deployment it better if the library can be loaded from package managers (NPM and bower).

CapMousse commented 7 years ago

You can install non npm package with npm with npm install git@github.com:CapMousse/include.js.git --save. It will create a "include.js": "git+ssh://git@github.com/CapMousse/include.js.git" line in your package list :)

pitronalldak commented 7 years ago

Hey. I have a problem... I installed the dep as you offered above. After that I imported in a constructor of class of my React app:

    this.include = require('../../node_modules/include.js/include.js');

Then I got my js file from apache and I had 200 OK:

this.include.include(['http://localhost:81/validator/validate.js'], function (d) {
    console.log(d);
}

And d receives 1. Do you have a guess what happened? Thank you in advance

CapMousse commented 7 years ago

I didn't try to use Include with React/NPM. Maybe it doesn't like to be "included". I will check that.

CapMousse commented 7 years ago

So, i'm working on a "npm friendly" version of Include.js. Some works need to be done to enable loading the module. So : soon™