Integrate Bower into grunt import task

This uses Bower to import the Normalize.css dependency.
This commit is contained in:
Eric Ferraiuolo 2013-05-23 13:54:51 +01:00
parent 0503c9f7da
commit 494885d292
6 changed files with 32 additions and 9 deletions

3
.bowerrc Normal file
View File

@ -0,0 +1,3 @@
{
"directory": "bower_components"
}

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
.DS_Store .DS_Store
bower_components/
build/ build/
node_modules/ node_modules/
release/ release/

View File

@ -18,7 +18,7 @@ grunt.initConfig({
build : ['build/'], build : ['build/'],
build_res: ['build/*-r.css'], build_res: ['build/*-r.css'],
release : ['release/<%= pkg.version %>/'], release : ['release/<%= pkg.version %>/'],
base : ['src/base/css/', 'src/base/tests/', 'src/base/LICENSE.md'] base : ['src/base/css/', 'src/base/LICENSE.md']
}, },
// -- Copy Config ---------------------------------------------------------- // -- Copy Config ----------------------------------------------------------
@ -40,8 +40,8 @@ grunt.initConfig({
normalize: { normalize: {
expand : true, expand : true,
flatten: true, flatten: true,
cwd : '../normalize.css/', cwd : 'bower_components/normalize-css/',
src : '{LICENSE.md,normalize.css,test.html}', src : '{LICENSE.md,normalize.css}',
dest : 'src/base/', dest : 'src/base/',
rename: function (dest, file) { rename: function (dest, file) {
@ -49,10 +49,6 @@ grunt.initConfig({
return path.join(dest, 'css', file); return path.join(dest, 'css', file);
} }
if (grunt.file.isMatch('*.html', file)) {
return path.join(dest, 'tests', 'manual', file);
}
return path.join(dest, file); return path.join(dest, file);
}, },
@ -236,6 +232,7 @@ grunt.registerTask('default', [
]); ]);
grunt.registerTask('import', [ grunt.registerTask('import', [
'bower-install',
'import-normalize' 'import-normalize'
]); ]);
@ -253,6 +250,17 @@ grunt.registerTask('import-normalize', [
'contextualize:normalize' 'contextualize:normalize'
]); ]);
// -- Bower Task ---------------------------------------------------------------
grunt.registerTask('bower-install', 'Installs Bower dependencies.', function () {
var bower = require('bower'),
done = this.async();
bower.commands.install()
.on('data', function (data) { grunt.log.write(data); })
.on('end', done);
});
// -- License Task ------------------------------------------------------------- // -- License Task -------------------------------------------------------------
grunt.registerMultiTask('license', 'Stamps license banners on files.', function () { grunt.registerMultiTask('license', 'Stamps license banners on files.', function () {

View File

@ -4,7 +4,10 @@ Pure Change History
NEXT NEXT
---- ----
* Clean up manual test files, removing unnecessary CSS files and cruft. * Integrated Bower into `grunt import` process.
* Cleaned up manual test files, removing unnecessary CSS files and cruft.
0.0.2 (2013-05-16) 0.0.2 (2013-05-16)
------------------ ------------------

7
bower.json Normal file
View File

@ -0,0 +1,7 @@
{
"name": "pure",
"version": "0.0.3pre",
"devDependencies": {
"normalize-css": "1.x"
}
}

View File

@ -9,6 +9,7 @@
"grunt-contrib-clean": "~0.4.1", "grunt-contrib-clean": "~0.4.1",
"grunt-contrib-copy": "~0.4.1", "grunt-contrib-copy": "~0.4.1",
"grunt-contrib-concat": "~0.3.0", "grunt-contrib-concat": "~0.3.0",
"grunt-contrib-compress": "~0.5.0" "grunt-contrib-compress": "~0.5.0",
"bower": "~0.9.2"
} }
} }