Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gulp task to bundle bower_components?

Tags:

gulp

bower

I'd appreciate it so much if someone could please tell me a good way to handle bundling bower components. I feel like I've tried everything... Although, I can't seem to find any gulp tasks that handle this already. Could it really not exist?

Let's say it doesn't exist. Worst case scenario is I have to specify the paths of each "dist" file from bower_components folder. (It is annoying that each component seems to have its own "dist" folder... nothing is standardized.)

So even if I do that, I've noticed some components like 'active-support' seem to have require('lodash') and such in them. I think that if I just simply copy that file, it will break because the requires won't resolve.

What am I missing? How do I simply take all bower_components and bundle into a "common.js"... is there a way or is it a clusterfluck?

like image 945
JayPrime2012 Avatar asked Apr 29 '14 08:04

JayPrime2012


1 Answers

Update

As pointed out by Alerty, the new Gulp policy seems to be: use bower directly and glob patterns (and hope that the packages maintainers have a proper "ignore" properties).


Previously

You can use main-bower-files or gulp-bower-src to get files from your bower components. They can also use "ignore" or "main" overrides in your own bower file.

like image 113
Brian Clozel Avatar answered Oct 02 '22 07:10

Brian Clozel