diff --git a/Gruntfile.js b/Gruntfile.js index 01dde02..8f144b0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -12,12 +12,6 @@ grunt.initConfig({ BUILD_COMMENT: 'THIS FILE IS GENERATED BY A BUILD SCRIPT - DO NOT EDIT!', - NORMALIZE_LICENSE: [ - '/*! normalize.css v1.1.1 | MIT License | git.io/normalize */', - '/*! Copyright (c) Nicolas Gallagher and Jonathan Neal */', - '\n' - ].join('\n'), - // -- Clean Config --------------------------------------------------------- clean: { @@ -173,6 +167,41 @@ grunt.initConfig({ } }, + // -- License Config ------------------------------------------------------- + + license: { + normalize: { + options: { + banner: [ + '/*!', + 'normalize.css v1.1.1 | MIT License | git.io/normalize', + 'Copyright (c) Nicolas Gallagher and Jonathan Neal', + '*/\n' + ].join('\n') + }, + + expand: true, + cwd : 'build/', + src : ['base*.css', 'forms*.css', 'tables*.css', 'kimono*.css'] + }, + + yahoo: { + options: { + banner: [ + '/*!', + 'Kimono <%= pkg.version %>', + 'Copyright 2013 Yahoo! Inc. All rights reserved.', + 'Licensed under the BSD License.', + 'https://github.com/yui/kimono/blob/master/LICENSE.md', + '*/\n' + ].join('\n') + }, + + expand: true, + src : ['build/*.css'] + } + }, + // -- Contextualize Config ------------------------------------------------- contextualize: { @@ -182,7 +211,7 @@ grunt.initConfig({ options: { prefix: '.k', - banner: '/* <%= BUILD_COMMENT %> */\n<%= NORMALIZE_LICENSE %>' + banner: '/* <%= BUILD_COMMENT %> */\n' } } } @@ -202,7 +231,8 @@ grunt.registerTask('default', [ 'concat:build', 'clean:build_res', 'cssmin', - 'concat:kimono' + 'concat:kimono', + 'license' ]); grunt.registerTask('import', [ @@ -223,6 +253,23 @@ grunt.registerTask('import-normalize', [ 'contextualize:normalize' ]); +// -- License Task ------------------------------------------------------------- + +grunt.registerMultiTask('license', 'Stamps license banners on files.', function () { + var options = this.options({banner: ''}), + banner = grunt.template.process(options.banner), + tally = 0; + + this.files.forEach(function (filePair) { + filePair.src.forEach(function (file) { + grunt.file.write(file, banner + grunt.file.read(file)); + tally += 1; + }); + }); + + grunt.log.writeln('Stampped license on ' + String(tally).cyan + ' files.'); +}); + // -- Contextualize Task ------------------------------------------------------- grunt.registerMultiTask('contextualize', 'Makes Contextualized CSS files.', function () {