amd-optimize icon indicating copy to clipboard operation
amd-optimize copied to clipboard

wrapFile, include

Open normanrz opened this issue 11 years ago • 6 comments

Append/prepend other files or modules to bundle

Log Time

normanrz avatar Feb 21 '14 20:02 normanrz

options.include doesn't work now?

tamtakoe avatar Dec 07 '14 18:12 tamtakoe

No, options.include is not supported yet. I'll happily accept PRs on that :-)

normanrz avatar Dec 08 '14 10:12 normanrz

It is not necessarily.

You can write in docs temporary descision:

.pipe(amdOptimize('main', {}))
.pipe(require('gulp-add-src')('other_amd_file.js'));

tamtakoe avatar Dec 08 '14 11:12 tamtakoe

Yeah, you're right. Turns out there is already a recipe in the readme for that using the event-stream module: https://github.com/scalableminds/amd-optimize#recommended-modules

normanrz avatar Dec 15 '14 15:12 normanrz

it's A solution but not THE solution :) I've used it for a bunch of simple modules containing viewmodels but I can't include the matching templates files... they can't go through amdoptimize and the require plugins (!text for now...) this way.

engyii avatar Dec 22 '14 11:12 engyii

:+1: for include. It's a really great tool when you want to include dynamic dependencies inside a bundle.

I would suggest a PR but I'm not at ease with coffeescript. I don't think this should be a very difficult feature, as it's just a matter of looping over the include and applying the same logic as you apply to the main module.

Currently I work around this by using merge-stream and gulp-unique-files. I loop over my include array and call amd-optimize for each entry, then I merge all the resulting streams and remove dups with gulp-unique-files. Could be a recipe in the readme until include is supported.

Another work-around I found is to build a fake file dynamically that requires everything you want to include and amd-optimize this.

jods4 avatar Jul 09 '15 16:07 jods4