Atwood's Law - Jeff Atwood, 2007
Any application that can
be written in Javascript,
will eventually
be written in Javascript
$ npm install
# Create bower.json file and install a package
$ bower init
$ bower install reveal.js --save
{
"name": "slides-grunt-bower",
"version": "0.0.1",
"dependencies": {
"reveal.js": "~2.6.2"
}
}
# Install all dependencies on bower.json
$ bower install
{
"directory": "components/"
}
$ bower install [package] --save
$ bower install [package]#[version] --save
$ npm install -g grunt-cli
{
"name": "slides-grunt-bower",
"version": "0.0.1",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-less": "^0.12.0",
}
}
# Create a basic package.json file
$ npm init
# Install Grunt
$ npm install grunt --save-dev
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
less: { /* Task config */ }
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.registerTask('default',['less',...]);
};
# Run Grunt tasks
$ grunt
$ grunt less
github.com/vladikoff/grunt-devtools / Chrome extension
$ npm install grunt-devtools --save-dev
grunt.loadNpmTasks('grunt-devtools');
$ grunt devtools
Open Chrome Developer tools. Find the Grunt tab
github.com/gruntjs/grunt-contrib-less / grunt-contrib-sass
$ npm install grunt-contrib-less --save-dev
less: {
compileCustom: {
options: {
cleancss: true
},
src: 'src/less/custom.less',
dest: 'src/css/custom.min.css'
}
}
bitbucket.org/carkraus/grunt-glue
# Requires Glue for Python
$ npm install grunt-glue --save-dev
glue: {
icons: {
src: 'assets/icons/',
options: '--less=src/less/sprites --img=src/images/sprites --url=../images/sprites/ --namespace=icon --margin=1 --project --retina --cachebuster-filename-only-sprites'
}
}
github.com/gruntjs/grunt-contrib-watch / Livereload
$ npm install grunt-contrib-watch --save-dev
watch: {
options: {
livereload: true,
},
less: {
files: 'src/less/**/*.less',
tasks: ['less', 'concat']
}
}
github.com/gruntjs/grunt-contrib-concat
$ npm install grunt-contrib-concat --save-dev
concat: {
slides: {
src: [
'components/reveal.js/.../head.min.js',
'components/reveal.js/.../reveal.min.js'
],
dest: 'src/js/slides.min.js'
}
}
github.com/gruntjs/grunt-contrib-uglify
$ npm install grunt-contrib-uglify --save-dev
uglify: {
markdown: {
src: 'components/.../markdown.js',
dest: 'src/js/markdown.min.js'
}
}
github.com/gruntjs/grunt-contrib-cssmin
$ npm install grunt-contrib-cssmin --save-dev
cssmin: {
extraCss: {
src: 'components/.../print/pdf.css',
dest: 'src/css/print.min.css'
}
}
github.com/gruntjs/grunt-contrib-imagemin
$ npm install grunt-contrib-imagemin --save-dev
imagemin: {
png: {
options: {optimizationLevel: 7},
files: [{
expand: true,
cwd: 'assets/images/',
src: ['**/*.png'],
dest: 'src/images/min/',
ext: '.png'
}]
I'm a javascript engineer!
I can write my own plugins ;)
The streaming build system
$ npm install -g gulp
$ npm install -g yo
$ npm install -g generator-webapp
$ yo webapp