Obligatory social media handles:
A Streaming Build System.
Capitalizes on a convention of Node.js that data flows in a single direction and changes happen to that data along the way.
Read In → Modify → Modify → Write Out
cat ~/.ssh/id_rsa.pub | pbcopy
gulp.src('~/.ssh/id_rsa.pub')
.pipe(clipboard());
gulp.task('task', ['deps'], callback);
gulp.task('heyo', function(){
console.log('whuddup!!');
});
gulp.task('sass', ['heyo'], function(){
// compile sass stuff here
});
gulp.watch('./src/css/*.css', ['compile', 'reload']);
Returns a Readable Stream
gulp.src('./src/sass/app.sass')
.pipe(sass())
.pipe(gulp.dest('./dist/app.css'));
Returns a "Through" stream
gulp.src('./src/css/app.css')
.pipe(minify())
.pipe(gulp.dest('./dist/app.css');
gulp default
// gulpfile.js
gulp.task('default', ['compile_sass', 'compile_js']);
The Package Manager for Node.js.
Tool to manage Package Dependencies.
Listing of all Packages you can install via NPM.
npm install jquery
// Saved in package.json
{
"dependencies": {
"jquery": "~1.11.0"
},
"devDependencies": {
"gulp": "^3.8.7"
}
}
Relative to your package.json file, in node_modules.
Can be strictly server-side, like gulp-clipboard,
or they can be libraries we're familiar with.
Reads through the javascript, and builds a
single javascript file based on what you require.
// Pulled in from package.json
var $ = require('jquery');
var _ = require('underscore');
// Pull in from /app/assets/js/view.js
var View = require('./view');
_.map(View.elements, function(el){
var $el = $(el);
$el.hide();
});
That's nice, but I'm a Javascript noob.
The best. Always.