module.exports = function (grunt) {
grunt.initConfig({
useminPrepare: {
html: ['**/*.html', '!js/**/*.html', '!dist/**/*.html', '!node_modules/**/*.html', '!unpackage/**/*.html', '!g/tmp/**/*.html', '!s/tmp/**/*.html'],
options: {
dest: 'dist'
}
},
usemin: {
html: ['dist/**/*.html'],
options: {
assetsDirs: ['dist'],
blockReplacements: {
MaxPrestaJSBuild: function (block) {
return '<script src="/js/vendor.min.js"></script>';
}
}
}
},
copy: {
dist: {
files: [
{ expand: true, cwd: 'fonts', src: '**', dest: 'dist/fonts/' },
{ expand: true, cwd: 'bin', src: '*.dll', dest: 'dist/bin/' },
{ expand: true, cwd: 'img', src: '**', dest: 'dist/img/' },
{ expand: true, cwd: 'js/ueditor', src: '**', dest: 'dist/js/ueditor/' },
{ expand: true, src: ['**/*.html', '!js/**/*.html', '!dist/**/*.html', '!node_modules/**/*.html', '!unpackage/**/*.html', '!g/tmp/**/*.html', '!s/tmp/**/*.html'], dest: 'dist/' },
{ src: 'Global.asax', dest: 'dist/Global.asax' },
{ src: 'NLog.config', dest: 'dist/NLog.config' },
{ src: 'js/video/video-js.css', dest: 'dist/js/video/video-js.css' },
{ src: 'js/video/video.6.0.js', dest: 'dist/js/video/video.6.0.js' },
{ src: 'js/jquery.cxselect.min.js', dest: 'dist/js/jquery.cxselect.min.js' },
{ src: 'js/cityData.min.json', dest: 'dist/js/cityData.min.json' },
{ expand: true, cwd: 'js/my97datepicker', src: '**', dest: 'dist/g' },
{ src:['*.aspx','*.aspx.cs','*.ashx'],dest:'dist/'}
]
},
js: {
files: []
}
},
htmlmin: {
dist: {
options: { removeComments: true, collapseWhitespace: true },
files: [
{
expand: true,
cwd: 'dist/',
src: ['**/*.html', '!g/tmp/**/*.html', '!s/tmp/**/*.html'],
dest: 'dist/'
}
]
}
},
filerev: {
options: {
encoding: 'utf8',
algorithm: 'md5',
length: 8
},
js: {
src: ['dist/js/**/m.*.min.js'],
dest: 'dist/js'
},
css: {
src: ['dist/css/**/m.*.min.css'],
dest: 'dist/css'
}
},
compress: {
main: {
options: {
archive: function () {
return 'dist/jfb-' + (new Date()).getTime() + '.tgz'
},
pretty: true,
mode: 'tgz'
},
expand: true,
cwd: 'dist/',
src: ['**/*'],
dest: '/'
}
},
exec: {
genGTmpl: {
cmd: 'tmod g/tmp --no-watch'
},
genSTmpl: {
cmd: 'tmod s/tmp --no-watch'
}
},
clean: {
dist: {
src: ['dist/']
},
tmp: {
src: ['.tmp/']
},
build: {
src: [
]
}
}
});
grunt.loadNpmTasks('grunt-usemin');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-assemble');
grunt.loadNpmTasks('grunt-filerev');
grunt.loadNpmTasks('grunt-exec');
grunt.registerTask('build', [
'clean:dist',
'exec:genGTmpl',
'exec:genSTmpl',
'copy',
'useminPrepare',
'concat:generated',
'cssmin:generated',
'uglify:generated',
'filerev',
'usemin',
'htmlmin',
'clean:tmp',
'copy:js',
'clean:build',
'compress:main'
]);
};