Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Esse cara é o Grunt

Esse cara é o Grunt

Davidson Fellipe

December 15, 2013
Tweet

More Decks by Davidson Fellipe

Other Decks in Programming

Transcript

  1. rodar testes pré-processadores:dev js/css lint web server scaffolding otimizar imagens

    criar sprites live reloading minificação e obfuscação concatenação pré-processadores:prod gerar release deploy dev prod
  2. module.exports = function(grunt){ grunt.initConfig({ pkg: grunt.file.readJSON(‘package.json’), uglify: {/* configuração da

    tarefa */} }); grunt.loadNpmTasks(‘grunt-contrib-uglify’); grunt.registerTask(‘default’, [‘uglify’]); } Gruntfile.js configuração
  3. grunt.initConfig({ uglify: { options: { banner: ‘/* dave fulêro */\n’

    }, build: { src: ‘src/<%= pkg.name %>.js’, dest: ‘build/<%= pkg.name %>.min.js’ } } });
  4. grunt.initConfig({ concat: { options: { separator: ';', }, dist: {

    src: ['src/a.js', 'src/e.js'], dest: 'build/vogais.js', } } }); concat no Gruntfile.js
  5. var toSeconds = function(hour) { return hour * 3600; };

    var toSeconds = function(a) { return a * 3600; }; var toSeconds=function(a){return a*3600;}; obfuscação minificação
  6. grunt.initConfig({ compass: { dev: { options: { sassDir: 'src/scss', cssDir:

    'build/css', imagesDir: 'src/img', generatedImagesDir: 'build/img' } }, prod: { /* ... */ } }}); compass no Gruntfile.js
  7. grunt.initConfig({ compass: { dev: { /* ... */ }, prod:

    { options: { sassDir: 'src/scss', cssDir: 'build/css', imagesDir: 'src/img', generatedImagesDir: 'build/img', outputStyle: 'compressed', noLineComments: true }}}}); compass no Gruntfile.js
  8. grunt.initConfig({ watch: { build: { files: ['src/**/*.{scss, js}'], tasks: [

    'compass:dev', 'concat', 'uglify' ] } } }); watch no Gruntfile.js