123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- module.exports = function (grunt) {
- grunt.initConfig({
- pkg: grunt.file.readJSON('package.json'),
- cssmin: {
- wui: {
- expand: true,
- cwd: 'src/wui',
- src: ['*.css', '!*.min.css'],
- dest: 'src/wui',
- ext: '.min.css'
- },
- 'wui-6': {
- expand: true,
- cwd: 'src/wui-6',
- src: ['*.css', '!*.min.css'],
- dest: 'src/wui-6',
- ext: '.min.css'
- },
- 'wui-8': {
- expand: true,
- cwd: 'src/wui-8',
- src: ['*.css', '!*.min.css'],
- dest: 'src/wui-8',
- ext: '.min.css'
- },
- upload: {
- expand: true,
- cwd: 'src/upload',
- src: ['*.css', '!*.min.css'],
- dest: 'src/upload',
- ext: '.min.css'
- }
- },
- uglify: {
- wui: {
- files: [{
- expand: true,
- cwd: 'src/wui',
- src: '**/*.js',
- dest: 'src/wui',
- rename: function (dst, src) {
- return dst + '/' + src.replace('.js', '.min.js');
- }
- }]
- },
- 'wui-6': {
- files: [{
- expand: true,
- cwd: 'src/wui-6',
- src: '**/*.js',
- dest: 'src/wui-6',
- rename: function (dst, src) {
- return dst + '/' + src.replace('.js', '.min.js');
- }
- }]
- },
- 'wui-8': {
- files: [{
- expand: true,
- cwd: 'src/wui-8',
- src: '**/*.js',
- dest: 'src/wui-8',
- rename: function (dst, src) {
- return dst + '/' + src.replace('.js', '.min.js');
- }
- }]
- },
- upload: {
- files: [{
- expand: true,
- cwd: 'src/upload',
- src: '**/*.js',
- dest: 'src/upload',
- rename: function (dst, src) {
- return dst + '/' + src.replace('.js', '.min.js');
- }
- }]
- }
- },
- compress: {
- wui: {
- options: { mode: 'gzip' },
- files: [
- {expand: true, cwd: 'src/wui/',src: ['*.min.js'], dest: 'dist/wui', ext: '.js'},
- {expand: true, cwd: 'src/wui/',src: ['*.min.css'], dest: 'dist/wui', ext: '.css'},
- {expand: true, cwd: 'src/wui/',src: ['*.min.html'], dest: 'dist/wui', ext: '.html'}
- ]
- },
- 'wui-6': {
- options: { mode: 'gzip' },
- files: [
- {expand: true, cwd: 'src/wui-6/',src: ['*.min.js'], dest: 'dist/wui-6', ext: '.js'},
- {expand: true, cwd: 'src/wui-6/',src: ['*.min.css'], dest: 'dist/wui-6', ext: '.css'},
- {expand: true, cwd: 'src/wui-6/',src: ['*.min.html'], dest: 'dist/wui-6', ext: '.html'}
- ]
- },
- 'wui-8': {
- options: { mode: 'gzip' },
- files: [
- {expand: true, cwd: 'src/wui-8/',src: ['*.min.js'], dest: 'dist/wui-8', ext: '.js'},
- {expand: true, cwd: 'src/wui-8/',src: ['*.min.css'], dest: 'dist/wui-8', ext: '.css'},
- {expand: true, cwd: 'src/wui-8/',src: ['*.min.html'], dest: 'dist/wui-8', ext: '.html'}
- ]
- },
- upload: {
- options: { mode: 'gzip' },
- files: [
- {expand: true, cwd: 'src/upload/',src: ['*.min.js'], dest: 'dist/upload', ext: '.js'},
- {expand: true, cwd: 'src/upload/',src: ['*.min.css'], dest: 'dist/upload', ext: '.css'},
- {expand: true, cwd: 'src/upload/',src: ['*.html'], dest: 'dist/upload', ext: '.html'}
- ]
- }
- },
- htmlmin: {
- wui: {
- options: { removeComments: true, collapseWhitespace: true },
- files: [{
- expand: true,
- cwd: 'src/wui',
- src: ['*.html'],
- dest: 'src/wui',
- rename: function (dst, src) {
- return dst + '/' + src.replace('.html', '.min.html');
- }
- }]
- },
- 'wui-6': {
- options: { removeComments: true, collapseWhitespace: true },
- files: [{
- expand: true,
- cwd: 'src/wui-6',
- src: ['*.html'],
- dest: 'src/wui-6',
- rename: function (dst, src) {
- return dst + '/' + src.replace('.html', '.min.html');
- }
- }]
- },
- 'wui-8': {
- options: { removeComments: true, collapseWhitespace: true },
- files: [{
- expand: true,
- cwd: 'src/wui-8',
- src: ['*.html'],
- dest: 'src/wui-8',
- rename: function (dst, src) {
- return dst + '/' + src.replace('.html', '.min.html');
- }
- }]
- },
- upload: {
- options: { removeComments: true, collapseWhitespace: true },
- files: [{
- expand: true,
- cwd: 'src/upload',
- src: ['*.html'],
- dest: 'src/upload',
- rename: function (dst, src) {
- return dst + '/' + src.replace('.html', '.min.html');
- }
- }]
- }
- },
- imagemin: {
- wui:{
- options: { optimizationLevel: 0 },
- files: [
- {'dist/wui/rotek.png': 'src/wui/rotek.png'},
- {'dist/wui/favicon.ico': 'src/wui/favicon.ico'}
- ]
- },
- 'wui-6':{
- options: { optimizationLevel: 0 },
- files: [
- {'dist/wui-6/rotek.png': 'src/wui-6/rotek.png'},
- {'dist/wui-6/favicon.ico': 'src/wui-6/favicon.ico'}
- ]
- },
- 'wui-8':{
- options: { optimizationLevel: 0 },
- files: [
- {'dist/wui-8/rotek.png': 'src/wui-8/rotek.png'},
- {'dist/wui-8/favicon.ico': 'src/wui-8/favicon.ico'}
- ]
- },
- upload:{
- options: { optimizationLevel: 0 },
- files: [
- {'dist/upload/favicon.ico': 'src/upload/favicon.ico'}
- ]
- }
- },
- clean: {
- all: {
- src: [
- '!src/**/*.js',
- '!src/**/*.css',
- 'src/**/*.min.js',
- 'src/**/*.min.css',
- 'src/**/*.min.html'
- ]
- },
- clear: {
- src: 'dist*/*'
- }
- },
- jshint: {
- all: ['Gruntfile.js', 'src/**/*.js']
- }
- });
- grunt.loadNpmTasks('grunt-contrib-htmlmin');
- grunt.loadNpmTasks('grunt-contrib-uglify');
- grunt.loadNpmTasks('grunt-contrib-cssmin');
- grunt.loadNpmTasks('grunt-contrib-clean');
- grunt.loadNpmTasks('grunt-contrib-compress');
- grunt.loadNpmTasks('grunt-contrib-imagemin');
- grunt.loadNpmTasks('grunt-contrib-jshint');
- grunt.registerTask('default', ['cssmin','uglify','htmlmin','clean:all']);
- grunt.registerTask('build', ['cssmin','uglify','htmlmin','compress','clean:all', 'imagemin']);
- grunt.registerTask('clear', ['clean:clear']);
- grunt.registerTask('jhint', ['jshint']);
- };
|