Created
November 19, 2014 15:39
-
-
Save luisdalmolin/05de89186d2d978950ee to your computer and use it in GitHub Desktop.
Exemplo de utilização do Grunt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
grunt.initConfig({ | |
uglify: { | |
options: { | |
mangle: false | |
}, | |
app: { | |
files: { | |
'public/assets/javascripts/js/main.min.js': [ // arquivo minificado | |
'public/assets/javascripts/js/main.js', // lista de arquivos a serem minificados | |
'public/assets/javascripts/js/modules/feedback.js' // caminho a partir do local do Gruntfile.js | |
] | |
} | |
} | |
}, | |
watch: { | |
js: { | |
files: ['public/assets/javascripts/js/app/**/*.js'], // caminho até a pasta de arquivos JS não minificados | |
tasks: ['uglify'] | |
} | |
}, | |
}); | |
// loaders | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
// tasks | |
grunt.registerTask('default', ['uglify', 'watch']); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"devDependencies": { | |
"grunt": "^0.4.5", | |
"grunt-contrib-uglify": "*", | |
"grunt-contrib-watch": "*" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# exemplo de utilização do grunt no shell | |
# instalando os pacotes | |
$ npm install | |
# compilando os arquivos | |
$ grunt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment