Browse Source

Adds more comments to grunt file, fixes comment banners and some

directory cleanup. Removes unused grunt libs.
pull/80/head
jlukic 11 years ago
parent
commit
f3ea765510
1 changed files with 118 additions and 68 deletions
  1. 186
      node/Gruntfile.js

186
node/Gruntfile.js

@ -1,9 +1,11 @@
module.exports = function(grunt) {
var
defaultTasks = [
// watch less folder
'watch'
],
watchTasks = [
// compiles less
'less:buildCSS',
@ -12,8 +14,12 @@ module.exports = function(grunt) {
'copy:toBuild',
// copies files over to docs
'copy:libraryToDocs'
'copy:buildToDocs',
// copies examples over to docs
'copy:examplesToDocs'
],
buildTasks = [
// clean build directory
'clean:build',
@ -51,8 +57,11 @@ module.exports = function(grunt) {
// copies spec files over to docs
'copy:specToDocs',
// copies examples over to docs
'copy:examplesToDocs',
// copies files over to docs
'copy:libraryToDocs'
'copy:buildToDocs'
],
config
;
@ -60,12 +69,16 @@ module.exports = function(grunt) {
config = {
package : grunt.file.readJSON('package.json'),
//server : grunt.file.readJSON('server.json'),
/*******************************
Watch
*******************************/
// watches for changes in a source folder
watch: {
scripts: {
files: [
'../examples/**/*',
'../src/**/*.less',
'../src/**/*.js'
],
@ -73,30 +86,21 @@ module.exports = function(grunt) {
}
},
/*******************************
Build
*******************************/
clean: {
build : {
cwd: '../build',
src: '*'
},
docs : {
cwd: 'src/files/release/',
cwd: 'src/files/build/',
src: '*'
}
},
docco: {
generate: {
expand : true,
cwd : '../spec',
src : [
'**/*.commented.js'
],
options: {
output: 'src/files/generated/'
}
}
},
less: {
options: {
compress : false,
@ -111,49 +115,40 @@ module.exports = function(grunt) {
src : [
'**/*.less'
],
dest : '../build/uncompressed',
ext : '.css'
}
},
compress: {
options: {
archive: 'src/files/release/semantic.zip'
},
everything: {
files: [
{
expand : true,
cwd : '../build/',
src : [
'**'
]
}
]
dest : '../build/uncompressed/',
// this allows multiple dot names to be preserved
rename: function(folder, filename) {
return folder + filename.substring(0, filename.lastIndexOf('.') ) + '.css';
}
}
},
copy: {
toBuild: {
files: [
// exact copy for less
{
expand : true,
cwd : '../src/',
src : [
'**/*.js',
'images/*',
'fonts/*'
'**/*'
],
dest : '../build/uncompressed'
dest : '../build/less'
},
// copy everything but less files for uncompressed release
{
expand : true,
cwd : '../src/',
src : [
'**/*'
'**/*.js',
'images/*',
'fonts/*'
],
dest : '../build/less'
dest : '../build/uncompressed'
},
// copy everything but less for minified release
{
expand : true,
cwd : '../src/',
@ -164,6 +159,8 @@ module.exports = function(grunt) {
],
dest : '../build/minified'
},
// copy assets only for packaged version
{
expand : true,
cwd : '../src/',
@ -175,7 +172,9 @@ module.exports = function(grunt) {
}
]
},
libraryToDocs: {
// make library available in docs
buildToDocs: {
files: [
{
expand : true,
@ -183,10 +182,12 @@ module.exports = function(grunt) {
src : [
'**'
],
dest : 'src/files/release/'
dest : 'src/files/build/'
}
]
},
// copy spec files to docs
specToDocs: {
files: [
{
@ -198,11 +199,60 @@ module.exports = function(grunt) {
dest : 'src/files/spec/'
}
]
},
// copy spec files to docs
examplesToDocs: {
files: [
{
expand : true,
cwd : '../examples',
src : [
'**'
],
dest : 'src/files/examples/'
}
]
}
},
// generate documented source code
docco: {
generate: {
expand : true,
cwd : '../spec',
src : [
'**/*.commented.js'
],
options: {
css: '',
output: 'src/files/generated/'
}
}
},
compress: {
// copies entire build to release zip
everything: {
options: {
archive: '../build/semantic.zip'
},
files: [
{
expand : true,
cwd : '../build/',
src : [
'**'
]
}
]
}
},
cssmin: {
// copy minified css to minified release
minifyCSS: {
expand : true,
cwd : '../build/uncompressed',
@ -213,13 +263,14 @@ module.exports = function(grunt) {
ext : '.min.css'
},
// add comment banner to css release
addBanner: {
options : {
banner : '' +
'/*\n' +
'* # <%= package.semantic.name %>\n' +
'* Version: <%= package.semantic.version %>\n' +
'* http://github.com/quirkyinc/semantic\n' +
'* http://github.com/jlukic/semantic-ui\n' +
'*\n' +
'*\n' +
'* Copyright <%= grunt.template.today("yyyy") %> Contributors\n' +
@ -246,7 +297,20 @@ module.exports = function(grunt) {
'**/*.js'
],
dest : '../build/minified',
ext : '.min.js'
ext : '.min.js',
banner : '' +
'/*' +
'* # <%= package.semantic.name %>\n' +
'* Version: <%= package.semantic.version %>\n' +
'* http://github.com/jlukic/semantic-ui\n' +
'*\n' +
'*\n' +
'* Copyright <%= grunt.template.today("yyyy") %> Contributors\n' +
'* Released under the MIT license\n' +
'* http://opensource.org/licenses/MIT\n' +
'*\n' +
'* Release Date: <%= grunt.template.today("mm/dd/yyyy") %>\n' +
'*/\n'
},
buildReleaseJS: {
@ -257,14 +321,14 @@ module.exports = function(grunt) {
'/*' +
'* # <%= package.semantic.name %>\n' +
'* Version: <%= package.semantic.version %>\n' +
'* http://github.com/quirkyinc/semantic\n' +
'* http://github.com/jlukic/semantic-ui\n' +
'*\n' +
'*\n' +
'* Copyright <%= grunt.template.today("yyyy") %> Contributors\n' +
'* Released under the MIT license\n' +
'* http://opensource.org/licenses/MIT\n' +
'*\n' +
'* Released: <%= grunt.template.today("mm/dd/yyyy") %>\n' +
'* Release Date: <%= grunt.template.today("mm/dd/yyyy") %>\n' +
'*/\n'
},
files: {
@ -273,38 +337,24 @@ module.exports = function(grunt) {
]
}
}
},
s3: {
options: '<%= server.cdn %>',
deploy: {
options: {
},
upload: [
{
src: '../docs',
dest: 'docs'
}
]
}
}
};
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-docco');
grunt.loadNpmTasks('grunt-bower-task');
grunt.loadNpmTasks('grunt-css');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-docco');
grunt.initConfig(config);
grunt.registerTask('default', defaultTasks);
grunt.registerTask('build', buildTasks);
};
Loading…
Cancel
Save