代码拉取完成,页面将自动刷新
同步操作将从 xman/Bui-Editor-public 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
module.exports = function (grunt) {
var taskArray = ['concat:bui','concat:editor','jshint','concat:all','uglify:buildall','copy:main','cssmin','copy:web','watch'];
//var taskArray = ['concat:bui','concat:editor','jshint','concat:all','copy:main','cssmin','watch'];
var pkgObj = grunt.file.readJSON('package.json');
grunt.initConfig({
pkg: pkgObj,
meta: {
banner: '/*! <%= pkg.name %>-v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd HH:mi:ss") %> \nCopyright (c): kevin.huang <%= pkg.site %> \nReleased under MIT License*/'
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
build: ['build/javascript/edit-<%= pkg.version %>.js']
},
copy: {
main:{
files: [
{ expand: true, cwd: 'src/theme/', src: ['**'], dest: 'build/theme/' },
{ src: ['src/javascript/editor/editConfig.js'], dest: 'build/javascript/editConfig.js' },
{ src: ['src/javascript/editor/emotionConfig.js'], dest: 'build/javascript/emotionConfig.js' }
]
},
web:{
//复制到ssm项目
files: [
{
src: ['build/javascript/editConfig.js'],
dest: 'E:/myprojects/bui-ssm/web/src/main/webapp/static/lib/editConfig.js'
},
{
src: ['build/javascript/emotionConfig.js'],
dest: 'E:/myprojects/bui-ssm/web/src/main/webapp/static/lib/emotionConfig.js'
}
, {
src: ['build/<%= pkg.toweb %>/edit-<%= pkg.version %>.js'],
dest: 'E:/myprojects/bui-ssm/web/src/main/webapp/static/lib/edit-<%= pkg.version %>.js'
},
{//复制到 editor 项目
expand: true,
cwd: 'build/',
src: ['**'],
dest: 'E:/myprojects/bui-ssm/editor/src/main/webapp/'
}
]
}
},
uglify: {
options: {
mangle: true, //不混淆变量名
stripBanners: true,
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> \nCopyright (c): kevin.huang <%= pkg.site %> \nReleased under MIT License*/\n'
},
buildall: {//压缩
options: {
mangle: true, //不混淆变量名
preserveComments: 'false'//不删除注释,还可以为 false(删除全部注释),some(保留@preserve @license @cc_on等注释)
},
files: [{
expand: true,
cwd: 'build/javascript',//js目录下
src: '**/*.js',//所有js文件
dest: 'build/javascript-min'//输出到此目录下
}]
}
},
cssmin: {
options: {
mergeIntoShorthands: false,
roundingPrecision: -1
},
target: {
files: {
'build/theme/font/bui-fonts.min.css': ['build/theme/font/bui-fonts.css'],
'build/theme/blue/main.min.css': ['build/theme/blue/main.css']
}
}
},
concat: {
options: {
//封装为一个文件
process: function(src, filepath) {
console.log(filepath);
if(filepath.indexOf("header") > 0){
src = src.replace("_ver_var_", pkgObj.name + "-" + pkgObj.version);
src = src.replace("_ver_site_", pkgObj.site);
src = src.replace("_ver_date_", grunt.template.today("yyyy-mm-dd"));
var newsrc =
"(function (global, factory) {\n"+
" if (typeof define === 'function' && define.amd && !window['_all_in_']) {\n"+
" define(['$B', 'toolbar', 'panel', 'colorpicker', 'plugin', 'utils', 'resize', 'mutilUpload', 'editConfig'], function (_$B) {\n"+
" return factory(global, _$B);\n"+
" });\n"+
" } else {\n"+
" if (!global['$B']) {\n"+
" global['$B'] = {};\n"+
" }\n"+
" factory(global, global['$B']);\n"+
" }\n"+
"}(typeof window !== 'undefined' ? window : this, function (window, $B) {\n" + src;
return newsrc;
}
if(filepath.indexOf("undo") > 0){
return src + '\n $B["Edit"] = Kedit;'
+'\n}));';
}
return src;
},
separator: '\n',
stripBanners: true,
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd hh:mm:ss") %> \nCopyright (c): kevin.huang <%= pkg.site %> \nReleased under MIT License*/\n'
},
bui: {
src: [
'src/javascript/bui/config.js',
'src/javascript/bui/basic.js',
'src/javascript/bui/colorpicker.js',
'src/javascript/bui/panel.js',
'src/javascript/bui/plugin.js',
'src/javascript/bui/resize.js',
'src/javascript/bui/toolbar.js',
'src/javascript/bui/upload.js',
'src/javascript/bui/utils.js'],
dest: 'build/javascript/edit-deps-<%= pkg.version %>.js'
},
editor:{
src:[
'src/javascript/editor/header.js',
'src/javascript/editor/toolbar.js',
'src/javascript/editor/core.js',
'src/javascript/editor/functions.js',
'src/javascript/editor/code.js',
'src/javascript/editor/float.js',
'src/javascript/editor/stack.js',
'src/javascript/editor/table.js',
'src/javascript/editor/undo.js'
],
dest: 'build/javascript/edit-<%= pkg.version %>.js'
},
all:{
src: ['build/javascript/edit-deps-<%= pkg.version %>.js',
'build/javascript/edit-<%= pkg.version %>.js'],
dest: 'build/javascript/edit-all-<%= pkg.version %>.js'
}
},
watch: {
build: {
files: ['src/javascript/bui/*.js',
'src/javascript/editor/*.js',
'src/theme/default/*.css'],
tasks: taskArray,
options: { spawn: false }
}
}
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', taskArray);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。