Skip to content

Instantly share code, notes, and snippets.

@emersonmx
Last active August 29, 2015 14:19
Show Gist options
  • Save emersonmx/c2b70848e7a0661acca1 to your computer and use it in GitHub Desktop.
Save emersonmx/c2b70848e7a0661acca1 to your computer and use it in GitHub Desktop.
Script para automatizar a criação de javascript e css
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
concat: {
dist: {
src: [
"js/*.js"
],
dest: "../static/js/blog.js"
}
},
uglify: {
build: {
src: "../static/js/blog.js",
dest: "../static/js/blog.min.js"
}
},
imagemin: {
dynamic: {
files: [{
expand: true,
cwd: "img/",
src: ["**/*.{png,jpg,gif}"],
dest: "../static/img/"
}]
}
},
sass: {
dist: {
options: {
style: "compressed"
},
files: {
"../static/css/blog.css": "sass/blog.scss"
}
}
},
watch: {
scripts: {
files: ["js/*.js"],
tasks: ["concat", "uglify"],
options: {
spawn: false
}
},
css: {
files: ["sass/*.scss"],
tasks: ["sass"],
options: {
spawn: false
}
}
}
});
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-imagemin");
grunt.loadNpmTasks("grunt-contrib-sass");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.registerTask("default", [
"concat", "uglify", "imagemin", "sass"
]);
}
{
"name": "assets",
"version": "1.0.0",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-imagemin": "^0.9.4",
"grunt-contrib-sass": "^0.9.2",
"grunt-contrib-uglify": "^0.9.1",
"grunt-contrib-watch": "^0.6.1"
}
}
#!/bin/bash
node_modules/grunt-cli/bin/grunt watch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment