Created by Josh Bavari / @jbavari
Demo time!
Think the systems all being tools in a toolshed. Each tool is used differently. Some focused on strictly atomic tasks. Others focused on one pass through. No tool is wrong, just different approaches.
Grunt has a plugin to run Gulp tasks, and Gulp has a plugin to run Grunt tasks.
Each tool has strengths and weaknesses. Your job will be to identify which tool may be best suited for your needs.
//Install grunt command line tools
npm install -g grunt-cli
//Specify plugins by saving to package.json file
npm install grunt-contrib-uglify --save-dev
npm install grunt-contrib-concat --save-dev
grunt.initConfig({
our_file_list: ['./src/js/{Models,Controllers}/*.js', './src/js/index.js'],
uglify: {
build: {
src: 'js/reveal.js',
dest: 'js/reveal.min.js'
},
all: {
files: {
'js/compiled/file.js': '<%= our_file_list %>',
}
}
},
concat: {
dist: {
src: ['js/reveal.min.js', 'js/compiled/file.js'],
dest: 'dist/built.js',
},
}
});
{
"name": "my-project-name",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-nodeunit": "~0.3.3",
"grunt-contrib-uglify": "~0.4.0"
}
}
//Run all uglify targets
grunt uglify
//Execute uglify, but only the all target
grunt uglify:all
//Install grunt command line tools
npm install -g gulp
//Specify plugins by saving to package.json file
npm install --save-dev gulp-uglify
npm install --save-dev gulp-concat
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
gulp.task('scripts', function() {
// Minify and copy all JavaScript (except vendor scripts)
return gulp.src(paths.scripts)
.pipe(uglify())
.pipe(concat('all.min.js'))
.pipe(gulp.dest('build/js'));
});
//Run all uglify targets
gulp scripts
Havent used long enough to form any
The first build system widely used and available. Uses skeletons (like scaffolding) to create app directory structure.
//Create new skeleton of angular app
brunch new https://github.com/scotch/angular-brunch-seed myapp
//Install bower packages (css/js/etc)
bower install
//tell Brunch to watch your project and incrementally rebuild it when source files are changed
brunch watch --server
//builds a project for distribution. By default it enables minification
brunch build --production
Mainly focused on Ember.js apps, and ships with Ember CLI