Java engineer here, new to the Javascript world, so apologies if I'm not providing enough/correct info!
I have a gulp build script and use bower to manage the dependencies for my JS frontend app. I am struggling to get the (bower controlled) vendor javascript libraries concatenated in the right order so that jQuery and angular come first.
If they aren't first then I get angular is undefined or jQuery is undefined when I load my application, as their corresponding javascript code is buried somewhere further down in the concatenated library.
I've attempted to use gulp-order to order the output from the resulting main-bower-files call, but it appears to have no effect.
My gulp task is as follows:
gulp.task('lib', function () {
var files =
gulp.src(mainBowerFiles({
paths: {
bowerrc: './.bowerrc',
bowerJson: './bower.json'
}, env: 'lib'}))
.pipe(order(["vendor/bower/jquery/**/*.js", "vendor/bower/angular/**/*.js", "vendor/bower/**/*.js" ]))
retu processJsFiles('lib', files);
});
processJsFiles does the uglify work and looks pretty much like:
.pipe(uglify(name + '.js', {
outSourceMap: true,
screwIe8: true,
compress: {
hoist_funs: false,
if_retu: false
}
}))
.pipe(gulp.dest(build_dir))
.pipe(gzip())
.pipe(gulp.dest(build_dir));
Any clues or better ways I should be doing this?
