Browse Source

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

directory cleanup. Removes unused grunt libs.


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