You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
217 lines
4.8 KiB
217 lines
4.8 KiB
module.exports = function(grunt) {
|
|
var
|
|
tasks = [
|
|
// clean build directory
|
|
'clean:build',
|
|
|
|
// compiles less
|
|
'less:buildCSS',
|
|
|
|
// copies assets and js over to build dir
|
|
'copy:toBuild',
|
|
|
|
// creates minified css of each file
|
|
'cssmin:minifyCSS',
|
|
|
|
// creates release css
|
|
'cssmin:buildReleaseCSS',
|
|
|
|
// creates minified js of each file
|
|
'uglify:minifyJS',
|
|
|
|
// creates release js of all together
|
|
'uglify:buildReleaseJS',
|
|
|
|
// cleans docs folder
|
|
'clean:docs',
|
|
|
|
// copies files over to docs
|
|
'copy:toDocs'
|
|
],
|
|
config
|
|
;
|
|
|
|
config = {
|
|
|
|
package: grunt.file.readJSON('package.json'),
|
|
|
|
// watches for changes in a source folder
|
|
watch: {
|
|
scripts: {
|
|
files: [
|
|
'../src/**/*.less',
|
|
'../src/**/*.js'
|
|
],
|
|
tasks : tasks
|
|
}
|
|
},
|
|
|
|
clean: {
|
|
build : {
|
|
cwd: '../build',
|
|
src: '*'
|
|
},
|
|
docs : {
|
|
cwd: 'src/files/components/semantic/',
|
|
src: '*'
|
|
}
|
|
},
|
|
|
|
less: {
|
|
options: {
|
|
compress : false,
|
|
optimization : 2
|
|
},
|
|
buildCSS: {
|
|
options : {
|
|
paths : ['../build']
|
|
},
|
|
expand : true,
|
|
cwd : '../src',
|
|
src : [
|
|
'**/*.less'
|
|
],
|
|
dest : '../build/uncompressed',
|
|
ext : '.css'
|
|
}
|
|
},
|
|
|
|
copy: {
|
|
toBuild: {
|
|
files: [
|
|
{
|
|
expand : true,
|
|
cwd : '../src/',
|
|
src : [
|
|
'**/*.js',
|
|
'images/*',
|
|
'fonts/*'
|
|
],
|
|
dest : '../build/uncompressed'
|
|
},
|
|
{
|
|
expand : true,
|
|
cwd : '../src/',
|
|
src : [
|
|
'**/*.js',
|
|
'images/*',
|
|
'fonts/*'
|
|
],
|
|
dest : '../build/minified'
|
|
},
|
|
{
|
|
expand : true,
|
|
cwd : '../src/',
|
|
src : [
|
|
'**/*.js',
|
|
'images/*',
|
|
'fonts/*'
|
|
],
|
|
dest : '../build/packaged'
|
|
}
|
|
]
|
|
},
|
|
toDocs: {
|
|
files: [
|
|
{
|
|
expand : true,
|
|
cwd : '../build/uncompressed',
|
|
src : [
|
|
'**'
|
|
],
|
|
dest : 'src/files/components/semantic/'
|
|
}
|
|
]
|
|
}
|
|
},
|
|
|
|
cssmin: {
|
|
|
|
minifyCSS: {
|
|
expand : true,
|
|
cwd : '../build/uncompressed',
|
|
src : [
|
|
'**/*.css'
|
|
],
|
|
dest : '../build/minified',
|
|
ext : '.min.css'
|
|
},
|
|
|
|
buildReleaseCSS: {
|
|
options : {
|
|
banner : '' +
|
|
'/*\n' +
|
|
'* # <%= package.semantic.name %>\n' +
|
|
'* Version: <%= package.semantic.version %>\n' +
|
|
'* http://github.com/quirkyinc/semantic\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' +
|
|
'*/\n'
|
|
},
|
|
files: {
|
|
'../build/packaged/semantic.min.css': [
|
|
'../build/uncompressed/**/*.css'
|
|
]
|
|
}
|
|
}
|
|
},
|
|
|
|
uglify: {
|
|
|
|
minifyJS: {
|
|
expand : true,
|
|
cwd : '../build/uncompressed',
|
|
src : [
|
|
'**/*.js'
|
|
],
|
|
dest : '../build/minified',
|
|
ext : '.min.js'
|
|
},
|
|
|
|
buildReleaseJS: {
|
|
options: {
|
|
mangle : true,
|
|
compress : true,
|
|
banner : '' +
|
|
'/*' +
|
|
'* # <%= package.semantic.name %>\n' +
|
|
'* Version: <%= package.semantic.version %>\n' +
|
|
'* http://github.com/quirkyinc/semantic\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' +
|
|
'*/\n'
|
|
},
|
|
files: {
|
|
'../build/packaged/semantic.min.js': [
|
|
'../build/uncompressed/**/*.js'
|
|
]
|
|
}
|
|
}
|
|
}
|
|
|
|
};
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
|
grunt.loadNpmTasks('grunt-bower-task');
|
|
grunt.loadNpmTasks('grunt-css');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
grunt.loadNpmTasks('grunt-contrib-less');
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
|
|
|
grunt.initConfig(config);
|
|
|
|
grunt.registerTask('default', [ 'watch' ]);
|
|
};
|