williamkapke / bndlr

Static Content Bundler
3 stars 4 forks source link

add files to bundle with url #2

Open robby opened 12 years ago

robby commented 12 years ago

Can you allow the bundle config to use a url to include in a file in the bundle?

Example in bundle.config.js:

module.exports = { js: { global: [ 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', 'robby.js', 'global.js' ] } };

williamkapke commented 12 years ago

Just for clarification: I am assuming you mean you want the content to be downloaded and then bundled.

I considered that. The biggest problem to overcome is making things async. I use require('/path/to/bundle.config.js') to load the configs. If we need to fetch content then we have a problem since there isn't an async version of require() yet. I would need to wait or find another way.

robby commented 12 years ago

Yes, I would want the content included in the bundle. What does reading the configs have to do with generating the bundles though? If you're reading the files async to generate the bundles, couldn't you load content from a url the same way?

williamkapke commented 12 years ago

I see your point. Currently, the content files are not read async- which allowed me to use getters: staticfile.content staticfile.minified ...etc

So, to change them to async- I would need: staticfile.content(callback) staticfile.contentSync() ..etc

My thinking was: Bundling shouldn't be done in production, so I'll keep it simple and just use Sync calls.

I'm still open to changing things to allow URLs, but I'm not convinced this use case is worth the trouble yet.