代码拉取完成,页面将自动刷新
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks
// Configuration
grunt.initConfig({
browserify: {
development: {
src: [
"src/*.js"
],
dest: 'dist/common.js',
options: {
browserifyOptions: { debug: true },
transform: [["babelify", { "presets": ["es2015"] }]],
plugin: [
["factor-bundle", {
outputs: [
'dist/builder.js',
'dist/components-bootstrap4.js',
'dist/inputs.js',
'dist/undo.js'
]
}]
],
watch: true,
keepAlive: true,
}
},
production: {
src: [
"src/*.js"
],
dest: 'dist/common.min.js',
options: {
browserifyOptions: { debug: false },
transform: [["babelify", { "presets": ["es2015"] }]],
plugin: [
["factor-bundle", {
outputs: [
'transpiled/builder.min.js',
'transpiled/components-bootstrap4.min.js',
'transpiled/inputs.min.js',
'transpiled/undo.min.js'
]
}],
["minifyify", { map: false }]
]
}
}
},
babel: {
options: {
sourceMap: true,
presets: ['env']
},
transpile: {
files: [
{
expand: true,
cwd: 'src/',
src: ['*.js'],
dest: 'transpiled/',
ext: '.babel.js'
}
]
},
build: {
files: {
'dist/built.js': 'concated/concated.js'
}
}
},
concat: {
es6: {
src: [
'transpiled/builder*.js',
'transpiled/undo*.js',
'transpiled/inputs*.js',
'transpiled/components-bootstrap4*.js'
],
dest: 'dist/built.js'
},
es5: {
src: [
'src/builder*.js',
'src/undo*.js',
'src/inputs*.js',
'src/components-bootstrap4*.js'
],
dest: 'concated/concated.js'
}
},
clean: {
concated: ['concated'],
built: ['dist'],
transpiled: ['transpiled']
}
});
// Load plugins
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-browserify');
// Register tasks
grunt.registerTask("build:dev", ['browserify:development']);
grunt.registerTask("build:prod", ['browserify:production']);
grunt.registerTask('build', ['clean:all', 'concat:es5', 'babel:build']);
grunt.registerTask('transpile', ['babel:transpile']);
grunt.registerTask('clean:all', ['clean:concated', 'clean:built', 'clean:transpiled']);
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。