-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This Gruntfile is the new one. Used now at mkt-virtual-theme [1] [1]:https://github.com/mktvirtual/mkt-virtual-theme
- Loading branch information
Hugo Bessa
committed
Aug 20, 2014
1 parent
98bbafa
commit 0ba9512
Showing
4 changed files
with
187 additions
and
170 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
var _ = require('lodash'); | ||
|
||
module.exports = function(grunt) { | ||
'use-strict'; | ||
|
||
/* Initialize configuration | ||
-----------------------------------------------------*/ | ||
|
||
require('load-grunt-tasks')(grunt); | ||
require('time-grunt')(grunt); | ||
|
||
// default config | ||
var config = { | ||
sourcemap: false, | ||
compass: false | ||
}; | ||
|
||
// apply command line configuration | ||
_.forEach(grunt.option.flags(), function(option) { | ||
config[option] = grunt.option(option); | ||
}); | ||
|
||
// default paths | ||
var paths = { | ||
assets: 'assets', | ||
build: 'assets', | ||
sass: 'sass', | ||
scss: 'scss', | ||
css: 'css', | ||
js: 'js', | ||
img: 'images', | ||
fonts: 'fonts' | ||
}; | ||
|
||
/* Tasks | ||
-----------------------------------------------------*/ | ||
|
||
var tasks = {}; | ||
tasks.paths = paths; | ||
|
||
// Watch--------------------------- | ||
// [TODO]: add support to compass | ||
// [TODO]: add support to coffee | ||
tasks.watch = { | ||
gruntfile: { | ||
files: ['./Gruntfile.js'], | ||
options: { | ||
reload: true | ||
} | ||
}, | ||
|
||
stylesheets: { | ||
files: [ | ||
'<%= paths.assets %>/<%= paths.scss %>/**/*.{scss,sass}', | ||
'<%= paths.assets %>/<%= paths.sass %>/**/*.{scss,sass}', | ||
], | ||
tasks: ['sass', 'autoprefixer'] | ||
} | ||
}; | ||
|
||
// BrowserSync -------------------- | ||
// [TODO]: configure proxy option | ||
tasks.browserSync = { | ||
dev: { | ||
bsFiles: { | ||
src: [ | ||
'<%= paths.build %>/<%= paths.css %>/**/*.css', | ||
'<%= paths.build %>/<%= paths.img %>/**/*.{png,jpg,gif}', | ||
'<%= paths.build %>/<%= paths.js %>/**/*.js', | ||
'**/*.php' | ||
] | ||
}, | ||
options: { | ||
watchTask: true, | ||
ghostMode: { | ||
location: true | ||
}, | ||
debugInfo: false // silence is golden. | ||
} | ||
} | ||
}; | ||
|
||
// Sass --------------------------- | ||
tasks.sass = { | ||
dev: { | ||
files: [ | ||
{ | ||
expand: true, | ||
cwd: '<%= paths.assets %>/<%= paths.scss %>/', | ||
src: [ | ||
'**/*.scss' | ||
], | ||
dest: '<%= paths.build %>/<%= paths.css %>', | ||
ext: '.css', | ||
extDot: 'last' | ||
}, | ||
{ | ||
expand: true, | ||
cwd: '<%= paths.assets %>/<%= paths.sass %>/', | ||
src: [ | ||
'**/*.sass' | ||
], | ||
dest: '<%= paths.build %>/<%= paths.css %>', | ||
ext: '.css', | ||
extDot: 'last' | ||
} | ||
], | ||
options: { | ||
style: 'compressed', | ||
sourcemap: config.sourcemap, | ||
compass: config.compass | ||
} | ||
} | ||
}; | ||
|
||
// Imagemin ----------------------- | ||
tasks.imagemin = { | ||
dev: { | ||
files: [{ | ||
expand: true, | ||
cwd: '<%= paths.assets %>/<%= paths.img %>', | ||
src: '**/*.{png,jpg,gif,svg}', | ||
dest: '<%= paths.build %>/<%= paths.img %>' | ||
}], | ||
options: { | ||
optimizationLevel: 7 | ||
} | ||
} | ||
}; | ||
|
||
// Autoprefixer ------------------- | ||
tasks.autoprefixer = { | ||
options: { | ||
map: true, | ||
browsers: ['last 2 versions', 'ie 8', 'ie 9', '> 1%'] | ||
}, | ||
dev: { | ||
files: [{ | ||
expand: true, | ||
cwd: '<%= paths.build %>/<%= paths.css %>/', | ||
src: [ | ||
'**/*.css' | ||
], | ||
dest: '<%= paths.build %>/<%= paths.css %>', | ||
ext: '.css', | ||
extDot: 'last' | ||
}] | ||
} | ||
}; | ||
|
||
// configures grunt | ||
grunt.initConfig(tasks); | ||
|
||
|
||
/* Group Tasks | ||
-----------------------------------------------------*/ | ||
|
||
grunt.registerTask('default', [ | ||
'browserSync', | ||
'watch' | ||
]); | ||
|
||
grunt.registerTask('build', [ | ||
'sass', | ||
'autoprefixer', | ||
'imagemin' | ||
]); | ||
|
||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ O Grunt é uma ferramenta de automação de tarefas em JavaScript. Com ele é po | |
|
||
## Usando | ||
|
||
O `Gruntfile.coffee` deste repositório serve como uma base sólida para a automação de tarefas na maioria dos projetos web da **Mkt Virtual**. | ||
O `Gruntfile.js` deste repositório serve como uma base sólida para a automação de tarefas na maioria dos projetos web da **Mkt Virtual**. | ||
|
||
Assumimos que você já tem o Grunt instalado na sua máquina de desenvolvimento. Para utilizá-lo execute os seguintes comandos: | ||
|
||
|
@@ -20,17 +20,15 @@ git clone [email protected]:mktvirtual/gruntfile.git gruntfile | |
cd gruntfile | ||
``` | ||
|
||
Copie os arquivos `package.json` e `Gruntfile.coffee` para a pasta do seu projeto e instale os plugins do Grunt usando o seguinte comando dentro da pasta: | ||
Copie os arquivos `package.json` e `Gruntfile.js` para a pasta do seu projeto e instale os plugins do Grunt usando o seguinte comando dentro da pasta: | ||
|
||
```shell | ||
npm install | ||
``` | ||
|
||
Após a instalação, edite o `Gruntfile.coffee` para atender as necessidades de cada projeto. Altere a variável `paths`, por exemplo, para adequar o arquivo à estruturação do seu projeto. Altere também o `package.json`, trocando para as suas informações. | ||
Após a instalação, edite o `Gruntfile.js` para atender as necessidades de cada projeto. Altere a variável `paths`, por exemplo, para adequar o arquivo à estruturação de pastas do seu projeto. Altere também o `package.json`, trocando para as suas informações. | ||
|
||
O arquivo `Gruntfile.coffee` está bem comentado e explicativo. | ||
|
||
*Dica: ignore a pasta node_modules caso use Git ou SVN.* | ||
*Dica: ignore a pasta `node_modules` caso use Git ou SVN.* | ||
|
||
## Extras | ||
|
||
|
@@ -41,9 +39,9 @@ Nem todos os plugins que achamos legais estão aqui, somente os mais importantes | |
Você pode contribuir, tanto arrumando [alguns problemas](https://github.com/mktvirtual/gruntfile/issues) quanto trazendo novidades. | ||
|
||
1. Crie um fork! | ||
2. Crie uma branch para a sua nova funcionalidae: `git checkout -b nova-funcionalidade` | ||
3. Dê Commit com as suas modificações: `git commit -m 'Nova funcionalidade'` | ||
4. Dê Push na branch: `git push origin nova-funcionalidade` | ||
2. Crie uma branch para a sua nova funcionalidae: `git checkout -b new-feature` | ||
3. Dê Commit com as suas modificações: `git commit -m 'New feature'` | ||
4. Dê Push na branch: `git push origin new-feature` | ||
5. Envie um pull request :D | ||
|
||
## Histórico | ||
|
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