Skip to content

Instantly share code, notes, and snippets.

@kylefox
Created January 15, 2016 17:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylefox/c7878177a07ec63d442a to your computer and use it in GitHub Desktop.
Save kylefox/c7878177a07ec63d442a to your computer and use it in GitHub Desktop.
I moved bower dependencies in my Ionic app from `./www/lib` to `./bower_modules` in order to slim down the resulting "www" package. Here are the gulp settings/tasks I use to compile/concatenate everything into `./www/js/libs.js`
var paths = {
// Manually specify the bower resources we actually need.
// This way our index simply has: <script src="js/libs.js"></script>
bower: {
scripts: [
"./bower_modules/ionic/js/ionic.bundle.js",
"./bower_modules/angular-resource/angular-resource.js",
],
fonts: [
"./bower_modules/ionic/fonts/**.*",
]
},
};
// Bundles the bower scripts we're using into www/js/libs.js
gulp.task('bower-scripts', function(done) {
gulp.src(paths.bower.scripts)
.pipe(concat('libs.js'))
.pipe(uglify({mangle: false}))
.pipe(gulp.dest('./www/js'))
.on('end', done);
});
// Copies fonts from Bower we're using into www/fonts/
gulp.task('bower-fonts', function(done) {
gulp.src(paths.bower.fonts)
.pipe(gulp.dest('./www/fonts'))
.on('end', done);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment