mirror of
https://github.com/pure-css/pure.git
synced 2024-11-07 21:34:24 +00:00
Tweak bower_json Grunt task to be more configurable
This commit is contained in:
parent
1f9ec2a22d
commit
5ee9222705
15
Gruntfile.js
15
Gruntfile.js
@ -13,12 +13,16 @@ grunt.initConfig({
|
||||
|
||||
bower_json: {
|
||||
release: {
|
||||
main: 'pure.css'
|
||||
values: {
|
||||
main: 'pure.css'
|
||||
},
|
||||
|
||||
dest: 'build/'
|
||||
}
|
||||
},
|
||||
|
||||
// -- Clean Config ---------------------------------------------------------
|
||||
|
||||
|
||||
clean: {
|
||||
build : ['build/'],
|
||||
build_res: ['build/*-r.css'],
|
||||
@ -34,9 +38,10 @@ grunt.initConfig({
|
||||
expand : true,
|
||||
flatten: true
|
||||
},
|
||||
|
||||
release: {
|
||||
src : '{LICENSE.md,README.md,HISTORY.md}',
|
||||
dest : 'build/'
|
||||
src : '{LICENSE.md,README.md,HISTORY.md}',
|
||||
dest: 'build/'
|
||||
}
|
||||
},
|
||||
|
||||
@ -258,7 +263,7 @@ grunt.registerTask('release', [
|
||||
'default',
|
||||
'clean:release',
|
||||
'copy:release',
|
||||
'bower_json',
|
||||
'bower_json:release',
|
||||
'compress:release'
|
||||
]);
|
||||
|
||||
|
@ -1,8 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerMultiTask('bower_json', 'Modifies bower.json "main".', function () {
|
||||
grunt.config('bower.main', this.data.main);
|
||||
grunt.file.write('build/bower.json', JSON.stringify(grunt.config('bower'),null,' '));
|
||||
grunt.registerMultiTask('bower_json', 'Modifies bower.json file.', function (target) {
|
||||
var values = this.data.values;
|
||||
|
||||
Object.keys(values).forEach(function (key) {
|
||||
grunt.config.set('bower.' + key, values[key]);
|
||||
grunt.log.writeln('Updated Bower ' +
|
||||
String(key).cyan + ': ' + String(values[key]).cyan);
|
||||
});
|
||||
|
||||
grunt.file.write(path.join(this.data.dest, 'bower.json'),
|
||||
JSON.stringify(grunt.config('bower'), null, ' '));
|
||||
});
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user