143 lines
4.5 KiB
JavaScript
143 lines
4.5 KiB
JavaScript
|
|
module.exports = function (grunt) {
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
uglify: {
|
|
options: {
|
|
banner: '/*! <%= pkg.name %> javascript <%= grunt.template.today("yyyy-mm-dd") %> */\n',
|
|
mangle:false
|
|
},
|
|
build: {
|
|
src: 'build/dist/js/<%= pkg.name %>.js',
|
|
dest: 'build/dist/js/<%= pkg.name %>.min.js'
|
|
},
|
|
vendor: {
|
|
src: [
|
|
'./vendor/bower/jquery/dist/jquery.js',
|
|
'./vendor/bower/uikit/dist/js/uikit.js',
|
|
'./vendor/bower/uikit/dist/js/uikit-icons.js'
|
|
],
|
|
dest: 'build/dist/js/vendor.min.js'
|
|
}
|
|
},
|
|
less: {
|
|
production: {
|
|
options: {
|
|
compress: false,
|
|
syncImport: true,
|
|
plugins: [
|
|
new (require('less-plugin-autoprefix'))({browsers: ["last 2 versions"]})
|
|
],
|
|
paths: [
|
|
'vendor/bower/uikit/src/less',
|
|
'vendor/bower/uikit/src/less/theme',
|
|
'vendor/bower/uikit/src/less/components'
|
|
]
|
|
},
|
|
files: {
|
|
'build/dist/css/<%= pkg.name %>.css': [
|
|
'./build/less/doughnut.less',
|
|
]
|
|
}
|
|
}
|
|
},
|
|
cssmin: {
|
|
production: {
|
|
files: [{
|
|
expand: true,
|
|
cwd: 'build/dist/css',
|
|
src: ['*.css', '!*.min.css'],
|
|
dest: 'build/dist/css',
|
|
ext: '.min.css'
|
|
}]
|
|
}
|
|
},
|
|
jshint: {
|
|
dev: ['Gruntfile.js', 'build/js/doughnut.js'],
|
|
options: {
|
|
// options here to override JSHint defaults
|
|
reporter: require('jshint-stylish'),
|
|
globals: {
|
|
jQuery: true,
|
|
console: true,
|
|
module: true,
|
|
document: true
|
|
}
|
|
}
|
|
},
|
|
concat: {
|
|
dist: {
|
|
src: [
|
|
'build/js/doughnut.js'
|
|
],
|
|
dest: 'build/dist/js/<%= pkg.name %>.js'
|
|
}
|
|
},
|
|
copy: {
|
|
main: {
|
|
files: [
|
|
{
|
|
expand: true,
|
|
cwd: 'build/dist/js',
|
|
src: ['*.min.js'],
|
|
dest: 'web/js',
|
|
filter: 'isFile'
|
|
},
|
|
{
|
|
expand: true,
|
|
cwd: 'build/dist/css',
|
|
src: ['*.min.css'],
|
|
dest: 'web/css',
|
|
filter: 'isFile'
|
|
},
|
|
{
|
|
expand: true,
|
|
cwd: './vendor/bower/uikit/dist/images',
|
|
src: ['**'],
|
|
dest: 'web/images'
|
|
}
|
|
]
|
|
}
|
|
},
|
|
watch: {
|
|
configFiles: {
|
|
files: ['Gruntfile.js', 'config/*.js'],
|
|
options: {
|
|
reload: true
|
|
}
|
|
},
|
|
less: {
|
|
files: 'build/less/*.less',
|
|
tasks: ['less', 'cssmin', 'copy']
|
|
},
|
|
js: {
|
|
files: 'build/js/doughnut.js',
|
|
tasks: ['concat:dist', 'jshint', 'uglify:build', 'copy']
|
|
}
|
|
},
|
|
clean: [
|
|
'build/dist',
|
|
'web/js/*.js',
|
|
'web/css/*.css',
|
|
'web/images/*.svg'
|
|
]
|
|
});
|
|
|
|
// Load the plugin that provides the "uglify" task.
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
grunt.loadNpmTasks('grunt-contrib-less');
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
|
// Default task(s).
|
|
grunt.registerTask('build', ['clean', 'concat', 'jshint', 'uglify', 'less', 'cssmin']);
|
|
grunt.registerTask('install', ['copy']);
|
|
grunt.registerTask('default', ['build', 'copy']);
|
|
|
|
|
|
}; |