fineui是帆软报表和BI产品线所使用的前端框架。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

323 lines
11 KiB

8 years ago
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
7 years ago
pkg: grunt.file.readJSON("package.json"),
8 years ago
concat: {
options: {
7 years ago
separator: ""
8 years ago
},
polyfillJs: {
7 years ago
src: ["src/polyfill/**/*.js"],
dest: "dist/polyfill.js"
},
8 years ago
coreJs: {
src: [
7 years ago
"src/core/jquery.js",
7 years ago
"src/core/lodash.js",
7 years ago
"src/core/foundation.js",
7 years ago
// 'src/core/mvc/**/*.js',
7 years ago
"src/core/base.js",
"src/core/ob.js",
"src/core/widget.js",
7 years ago
// 'src/core/model.js',
// 'src/core/view.js',
7 years ago
"src/core/shortcut.js",
"src/core/utils/*.js",
"src/core/behavior/behavior.js",
"src/core/wrapper/layout.js",
7 years ago
"src/core/plugin.js",
7 years ago
"src/core/**/*.js",
"src/data/data.js",
7 years ago
"src/data/**/*.js"
8 years ago
],
7 years ago
dest: "dist/core.js"
8 years ago
},
8 years ago
7 years ago
// 最基础的控件
8 years ago
baseJs: {
src: [
7 years ago
"src/third/**/*.js",
"src/base/formula/config.js",
"src/base/pane.js",
"src/base/single/single.js",
"src/base/single/text.js",
"src/base/single/button/button.basic.js",
"src/base/single/button/button.node.js",
"src/base/single/tip/tip.js",
"src/base/combination/group.button.js",
"src/base/combination/tree.button.js",
"src/base/combination/map.button.js",
"src/base/tree/treeview.js",
"src/base/tree/asynctree.js",
"src/base/tree/parttree.js",
"src/base/**/*.js"
8 years ago
],
7 years ago
dest: "dist/base.js"
8 years ago
},
7 years ago
// 实现好的一些基础实例
8 years ago
caseJs: {
src: [
7 years ago
"src/case/combo/popup.bubble.js",
"src/case/**/*.js"
8 years ago
],
7 years ago
dest: "dist/case.js"
8 years ago
},
widgetJs: {
src: [
7 years ago
"src/widget/paramsettingcombo/popup.param.js",
"src/widget/sequencetable/treenumber.sequencetable.js",
"src/widget/**/*.js",
"src/component/**/*.js"
],
7 years ago
dest: "dist/widget.js"
},
7 years ago
routerJs: {
src: [
7 years ago
"src/router/**/*.js"
7 years ago
],
7 years ago
dest: "dist/router.js"
7 years ago
},
8 years ago
coreCss: {
7 years ago
src: ["src/css/core/**/*.css", "src/css/theme/**/*.css"],
dest: "dist/core.css"
8 years ago
},
7 years ago
coreWithoutNormalizeCss: {
7 years ago
src: ["src/css/core/**/*.css", "src/css/theme/**/*.css", "!src/css/core/normalize.css", "!src/css/core/normalize2.css"],
dest: "dist/core_without_normalize.css"
7 years ago
},
8 years ago
baseCss: {
7 years ago
src: ["src/css/base/**/*.css"],
dest: "dist/base.css"
8 years ago
},
widgetCss: {
7 years ago
src: ["src/css/widget/**/*.css"],
dest: "dist/widget.css"
},
8 years ago
resourceCss: {
7 years ago
src: ["src/css/resource/**/*.css"],
dest: "dist/resource.css"
8 years ago
},
8 years ago
7 years ago
bundleJs: {
7 years ago
src: ["dist/core.js", "dist/fix/fix.js", "dist/base.js", "dist/case.js", "dist/widget.js", "dist/fix/fix.compact.js", "dist/router.js", "public/js/**/*.js", "public/js/index.js"],
7 years ago
dest: "dist/bundle.js"
7 years ago
},
7 years ago
bundleCss: {
7 years ago
src: ["dist/core.css", "dist/base.css", "dist/widget.css", "public/css/app.css", "public/css/**/*.css"],
dest: "dist/bundle.css"
7 years ago
},
fineuiMinJs: {
7 years ago
src: ["dist/_fineui.min.js", "src/base/formula/formulaeditor.js"],
dest: "dist/fineui.min.js"
7 years ago
},
fineuiJs: {
src: ["dist/polyfill.js", "dist/core.js", "dist/fix/fix.js", "src/third/**/*.js",
"src/base/formula/config.js",
"src/base/pane.js",
"src/base/single/single.js",
"src/base/single/text.js",
"src/base/single/button/button.basic.js",
"src/base/single/button/button.node.js",
"src/base/single/tip/tip.js",
"src/base/combination/group.button.js",
"src/base/combination/tree.button.js",
"src/base/combination/map.button.js",
"src/base/tree/treeview.js",
"src/base/tree/asynctree.js",
"src/base/tree/parttree.js",
"src/base/**/*.js",
"dist/case.js", "dist/widget.js", "dist/fix/fix.compact.js", "dist/router.js", "ui/js/**/*.js"],
dest: "dist/fineui.js"
},
7 years ago
fineuiCss: {
src: ["dist/core.css", "dist/base.css", "dist/widget.css", "ui/css/app.css", "ui/css/**/*.css"],
dest: "dist/fineui.css"
},
7 years ago
configJs: {
7 years ago
src: ["demo/version.js"],
dest: "dist/config.js"
7 years ago
},
8 years ago
demoJs: {
7 years ago
src: ["demo/app.js", "demo/js/**/*.js", "demo/config.js"],
7 years ago
dest: "dist/demo.js"
8 years ago
},
demoCss: {
7 years ago
src: ["demo/css/**/*.css"],
dest: "dist/demo.css"
},
7 years ago
utilsJs: {
src: [
7 years ago
"src/core/lodash.js",
7 years ago
"src/core/foundation.js",
"src/core/var.js",
"src/core/proto/array.js",
"src/core/proto/number.js",
"src/core/proto/string.js",
7 years ago
"src/core/proto/date.js",
"src/core/proto/function.js",
7 years ago
"src/core/base.js",
"src/core/ob.js",
"src/core/alias.js",
"src/core/inject.js",
"src/core/utils/*.js",
"src/data/data.js",
"src/data/**/*.js"
7 years ago
],
6 years ago
dest: "dist/utils.js"
7 years ago
}
8 years ago
},
8 years ago
less: {
7 years ago
demo: {
8 years ago
expand: true,
7 years ago
cwd: "demo/less",
src: ["**/*.less"],
dest: "demo/css/",
ext: ".css"
8 years ago
},
7 years ago
main: {
expand: true,
cwd: "public/less",
src: ["**/*.less"],
dest: "public/css",
ext: ".css"
},
7 years ago
ui: {
expand: true,
cwd: "ui/less",
src: ["**/*.less"],
dest: "ui/css",
ext: ".css"
},
7 years ago
src: {
expand: true,
cwd: "src/less",
src: ["**/*.less"],
dest: "src/css",
ext: ".css"
},
8 years ago
dev: {
options: {
compress: true,
yuicompress: false
}
}
},
7 years ago
uglify: {
8 years ago
options: {
7 years ago
banner: "/*! <%= pkg.name %> <%= grunt.template.today(\"dd-mm-yyyy\") %> */\n"
8 years ago
},
dist: {
files: {
7 years ago
"dist/bundle.min.js": ["<%= concat.bundleJs.dest %>"],
6 years ago
"dist/utils.min.js": ["<%= concat.utilsJs.dest %>"],
7 years ago
"dist/_fineui.min.js": ["dist/polyfill.js", "dist/core.js", "dist/fix/fix.js", "src/third/**/*.js",
7 years ago
"src/base/formula/config.js",
"src/base/pane.js",
"src/base/single/single.js",
"src/base/single/text.js",
"src/base/single/button/button.basic.js",
"src/base/single/button/button.node.js",
"src/base/single/tip/tip.js",
"src/base/combination/group.button.js",
"src/base/combination/tree.button.js",
"src/base/combination/map.button.js",
"src/base/tree/treeview.js",
"src/base/tree/asynctree.js",
"src/base/tree/parttree.js",
"src/base/**/*.js",
"!src/base/formula/formulaeditor.js",
7 years ago
"dist/case.js", "dist/widget.js", "dist/fix/fix.compact.js", "dist/router.js", "ui/js/**/*.js"]
8 years ago
}
}
},
cssmin: {
7 years ago
bundleCss: {
8 years ago
7 years ago
src: "<%= concat.bundleCss.dest %>",
8 years ago
7 years ago
dest: "dist/bundle.min.css"
8 years ago
},
7 years ago
fineuiCss: {
src: "<%= concat.fineuiCss.dest %>",
dest: "dist/fineui.min.css"
}
8 years ago
},
jshint: {
7 years ago
files: ["Gruntfile.js", "src/**/*.js"],
8 years ago
options: {
globals: {
jQuery: true,
console: true,
module: true,
document: true
}
}
},
watch: {
scripts: {
7 years ago
files: ["src/**/*.js", "demo/js/**/*.js", "demo/version.js", "demo/config.js", "demo/less/**/*.less"],
tasks: ["less", "concat"],
8 years ago
options: {
spanw: true,
interrupt: true
}
7 years ago
},
livereload: {
options: {
livereload: "<%= connect.options.livereload %>"
},
files: ["src/**/*.js", "src/**/*.less"]
}
},
connect: {
options: {
port: 9000,
open: true,
livereload: 35729,
// Change this to '0.0.0.0' to access the server from outside
6 years ago
hostname: "0.0.0.0"
7 years ago
},
server: {
options: {
port: 9001,
base: "./dist"
}
8 years ago
}
}
});
7 years ago
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-less");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-cssmin");
7 years ago
grunt.loadNpmTasks("grunt-contrib-connect");
8 years ago
7 years ago
var defaultTask = ["less", "concat", "connect", "watch"];
grunt.registerTask("default", defaultTask);
grunt.registerTask("compile", function () {
grunt.config.set("connect.options.open", false);
grunt.task.run(defaultTask);
});
7 years ago
grunt.registerTask("min", ["less", "concat", "uglify", "cssmin"]);
7 years ago
grunt.registerTask("build", ["less", "concat", "uglify", "cssmin", "uglify", "concat"]);
7 years ago
};