scalableminds / amd-optimize

An AMD (RequireJS) optimizer that's stream-friendly. Made for gulp.
MIT License
162 stars 29 forks source link

Allow remote scripts as dependency #49

Open ghost opened 9 years ago

ghost commented 9 years ago

In one of projects, we are required to use some third-party trackers, like google analytics. With requirejs it is just possible to provide a config file aliasing them to some dependency in paths. That forces us to use full requirejs instead of almond because frequent changes in remote trackers could fail anything. WIth amd-optimize, however, it fails when the remote script is in config.

I propose to replace aliases with full uri's from config and leave them to requirejs to handle.

normanrz commented 9 years ago

I am very sorry, but I am a bit confused about this. Could you include a code snippet to help me understand? If you'd like to implement the changes yourself, feel free to submit a PR. I'd be happy to review them.

ghost commented 9 years ago

I mean you can just require google analytics with requirejs like this var analytics = require('//www.google-analytics.com/analytics.js');’ or define it inpaths` config, but you can't download it to use with almond, because amd-optimize does not support remote scripts.

zeakd commented 9 years ago

maybe it could help http://requirejs.org/docs/optimization.html#empty