UNPKG

generator-nd

Version:

generate front-end files for projects and modules

128 lines (107 loc) 2.67 kB
/** * @author: <%= user.name %> <<%= user.email %>> - <%= time %> */ 'use strict'; module.exports = function(grunt) { // 显示任务执行时间 require('time-grunt')(grunt); // load all grunt tasks require('load-grunt-tasks')(grunt); var pkg = grunt.file.readJSON('package.json'); grunt.initConfig({ pkg: pkg, server: { // 开发环境 develop: { options: { // 指向上级目录 base: '..', // host: '127.0.0.1', // post: 80, release: false } }, // 仿真线上环境 release: { options: { base: '..', // host: '127.0.0.1', // post: 80, release: true } } }, jshint: { options: { jshintrc: true }, app: ['app/**/*.js'], mod: ['mod/**/*.js'] }, jsdoc: { app: { src: ['app/**/*.js'], options: { destination: 'doc/app' } }, mod: { src: ['mod/**/*.js'], options: { destination: 'doc/mod' } } }, exec: { 'spm-build': 'spm build' }, sass: { theme: { options: { compass: true, // nested, compact, compressed, expanded style: 'compressed' }, files: [{ expand: true, cwd: 'theme/default/scss', src: ['**/*.scss'], dest: 'theme/default/css', ext: '.css' }] } }, uglify: { options: { banner: '/*! <%%= pkg.name %> - v<%%= pkg.version %> - <%%= grunt.template.today("yyyymmdd") %> */\n', beautify: { 'ascii_only': true }, compress: { 'global_defs': { 'DEBUG': false }, 'dead_code': true } }, config: { files: { 'lib/config.js': 'lib/config.js' } } }, clean: { doc: ['doc'], theme: ['theme/default/css'] } }); grunt.registerTask('build-theme', ['clean', 'sass']); grunt.registerTask('build-app', ['exec']); grunt.registerTask('build-lib', ['uglify']); grunt.registerTask('test', ['jshint']); grunt.registerTask('build', ['build-theme', 'build-app', 'build-lib']); grunt.registerTask('doc', ['clean:doc', 'jsdoc']); grunt.registerTask('develop', ['server:develop']); grunt.registerTask('release', ['server:release']); grunt.registerTask('default', ['test', 'build', 'doc']); };