On Github hugobessaa / automacao-grunt
Minificar, concatenar, pré-processadores, otimizar, copiar, validar, testes unitários, servidor, deploy…
Aplicar boas práticas de UI
Testes de experiência de usuário
Ajustes de performance no código
<target name="js.minify" depends="js.preprocess"> <apply executable="java" parallel="false"> <fileset dir="." includes="foo.js, bar.js"/> <arg line="-jar"/> <arg path="yuicompressor.jar"/> <srcfile/> <arg line="-o"/> <mapper type="glob" from="*.js" to="*-min.js"/> <targetfile/> </apply> </target>
'use-strict'; module.exports = function(grunt) { grunt.initConfig({ task: { files: ['bom-framework.css', '!bootstrap.css'] } }); };
'use-strict'; module.exports = function(grunt) { grunt.initConfig({ coffee: { options: { bare: true }, all: { expand: true, cwd: 'assets/coffee', src: '**/*.coffee', dest: 'assets/js', ext: '.js' } } }); grunt.loadNpmTasks( 'grunt-contrib-coffee' ); };
watch: { main: { files: [ 'js/reveal.js', 'css/reveal.css' ], tasks: 'default' } }
sass: { dist: { files: { 'main.css': 'main.scss' } } }
coffee: { compile: { files: { 'path/to/result.js': 'path/to/source.coffee' } }
$ sudo npm install -g grunt-cli
{ "name": "Automação de Tarefas com Grunt", "description": "Uma apresentação", "devDependencies": { "grunt": "~0.4.2" } }
$ npm install grunt-contrib-coffee --save-dev $ npm install grunt-contrib-sass --save-dev $ npm install grunt-contrib-watch --save-dev
grunt.loadNpmTasks( 'grunt-contrib-coffee' ); grunt.loadNpmTasks( 'grunt-contrib-sass' ); grunt.loadNpmTasks( 'grunt-contrib-watch' );