143 lines
3.1 KiB
JavaScript
143 lines
3.1 KiB
JavaScript
/*
|
|
The Following folder structure is required:
|
|
|
|
./
|
|
./dist
|
|
app.js
|
|
app.min.js
|
|
app.min.zipped.js
|
|
design.css
|
|
design.min.css
|
|
design.min.zipped.css
|
|
./src
|
|
./src/js
|
|
.src/js/core
|
|
.src/js/modules
|
|
init.js
|
|
design.less
|
|
./styleguide
|
|
./styleguide/template
|
|
index.html
|
|
section-1.html
|
|
section-2.html
|
|
section-3.html
|
|
section-5.html
|
|
*/
|
|
module.exports = function(grunt) {
|
|
|
|
// Project configuration.
|
|
grunt.initConfig({
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
csslint: {
|
|
strict: {
|
|
src: ['dist/design.css']
|
|
}
|
|
},
|
|
compress: {
|
|
main: {
|
|
options: {
|
|
mode: 'gzip'
|
|
},
|
|
files: [
|
|
{
|
|
expand: true,
|
|
src: ['dist/app.min.js'],
|
|
dest: '',
|
|
ext: '.min.zipped.js'
|
|
},
|
|
{
|
|
expand: true,
|
|
src: ['dist/design.min.css'],
|
|
dest: '',
|
|
ext: '.min.zipped.css'
|
|
}
|
|
]
|
|
}
|
|
},
|
|
concat: {
|
|
dist: {
|
|
src: ['src/js/core/*.js', 'src/js/modules/*.js', 'src/js/init.js'],
|
|
dest: 'dist/app.js',
|
|
},
|
|
},
|
|
devserver: {
|
|
"options": {
|
|
"port": 8888
|
|
},
|
|
server: {}
|
|
},
|
|
htmllint: {
|
|
all: ["styleguide/*.html"]
|
|
},
|
|
jasmine: {
|
|
pivotal: {
|
|
src: ['src/js/*/*.js'],
|
|
options: {
|
|
specs: 'spec/*Spec.js',
|
|
helpers: 'spec/*Helper.js'
|
|
}
|
|
}
|
|
},
|
|
jslint: {
|
|
client: {
|
|
src: [
|
|
'src/js/*/*.js',
|
|
'src/js/*.js'
|
|
],
|
|
exclude: [],
|
|
}
|
|
},
|
|
kss: {
|
|
options: {
|
|
template: 'styleguide/template', // create this manually: `kss-node -i styleguide/template`
|
|
includeType: 'less'
|
|
},
|
|
files: {
|
|
src: ['src/less'],
|
|
dest: 'styleguide'
|
|
}
|
|
},
|
|
less: {
|
|
development: {
|
|
files: {
|
|
"dist": "src/less"
|
|
},
|
|
files: {
|
|
"dist/design.css": "src/less/design.less"
|
|
}
|
|
},
|
|
production: {
|
|
options: {
|
|
cleancss: true
|
|
},
|
|
files: {
|
|
"dist/design.min.css": "src/less/design.less"
|
|
}
|
|
}
|
|
},
|
|
uglify: {
|
|
options: {
|
|
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
|
|
},
|
|
build: {
|
|
src: 'dist/app.js',
|
|
dest: 'dist/app.min.js'
|
|
}
|
|
}
|
|
});
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-compress');
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
grunt.loadNpmTasks('grunt-contrib-csslint');
|
|
grunt.loadNpmTasks('grunt-contrib-jasmine');
|
|
grunt.loadNpmTasks('grunt-contrib-less');
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
grunt.loadNpmTasks('grunt-devserver');
|
|
grunt.loadNpmTasks('grunt-html');
|
|
grunt.loadNpmTasks('grunt-jslint');
|
|
grunt.loadNpmTasks('grunt-kss');
|
|
|
|
grunt.registerTask('deploy', ['less:production', 'less:development', 'concat', 'uglify', 'compress', 'kss']);
|
|
grunt.registerTask('test', ['htmllint', 'csslint', 'jslint', 'jasmine']);
|
|
grunt.registerTask('default', ['test']);
|
|
};
|