Skip to content

Instantly share code, notes, and snippets.

@Renatodeluna
Created November 4, 2013 16:56
Show Gist options
  • Save Renatodeluna/7305657 to your computer and use it in GitHub Desktop.
Save Renatodeluna/7305657 to your computer and use it in GitHub Desktop.
Rodando a task connect e watch juntos
module.exports = function (grunt) {
'user strict';
// Configurando Tarefas
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Inicia um server estático
connect: {
server: {
options: {
port: 9001,
livereload: true,
open: true
}
}
},
// Concatena e minifica - Scripts
uglify: {
options: {
mangle: true
},
target: {
files: {
'js/scripts.min.js' : ['js/scripts.js']
}
}
},
// Compilação - Compass/Sass
compass: {
dev: {
options: {
sassDir: 'sass/',
cssDir: 'css/',
outputStyle: 'expanded',
fontsDir: 'fonts',
imagesDir: 'images/',
generatedImagesDir: 'sprites/',
relativeAssets: true
}
}
},
// Observa mudanças nos arquivos
watch: {
options: {
livereload: true
},
sass: { // Compilação
files : 'sass/**',
tasks : 'compass'
},
js: { // Concayenação + Minificação
files: 'js/scripts.js',
tasks: 'uglify'
}
}
});
// Carregando plugins
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
// Registrando tarefas
grunt.registerTask( "default", [ "connect", "watch" ]);
};
{
"name": "grunt-test",
"title": "Grunt test",
"version": "0.0.0",
"description": "",
"homepage": "http://www.projecturl.com",
"main": "index.html",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-compass": "~0.6.0",
"grunt-contrib-watch": "~0.4.4",
"grunt-contrib-uglify": "~0.2.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment