Skip to content

Instantly share code, notes, and snippets.

@luisdalmolin
Created November 19, 2014 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luisdalmolin/05de89186d2d978950ee to your computer and use it in GitHub Desktop.
Save luisdalmolin/05de89186d2d978950ee to your computer and use it in GitHub Desktop.
Exemplo de utilização do Grunt
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']);
};
{
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-uglify": "*",
"grunt-contrib-watch": "*"
}
}
# 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