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.

362 lines
12 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: {
6 years ago
src: ["src/core/foundation.js", "src/polyfill/**/*.js"],
7 years ago
dest: "dist/polyfill.js"
},
8 years ago
coreJs: {
src: [
6 years ago
"src/core/foundation.js",
7 years ago
"src/core/lodash.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",
6 years ago
"src/core/utils/**/*.js",
7 years ago
"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/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",
6 years ago
"src/base/tree/ztree/treeview.js",
"src/base/tree/ztree/asynctree.js",
"src/base/tree/ztree/parttree.js",
7 years ago
"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/**/*.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
},
6 years ago
bundleIEJs: {
src: ["dist/core.js", "dist/fix/fix.ie.js", "dist/base.js", "dist/case.js", "dist/widget.js", "dist/fix/fix.compact.ie.js", "dist/router.js", "public/js/**/*.js", "public/js/index.js"],
dest: "dist/bundle.ie.js"
},
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
},
fineuiJs: {
6 years ago
src: ["dist/polyfill.js", "dist/core.js", "dist/fix/fix.js", "dist/base.js",
"dist/case.js", "dist/widget.js", "dist/router.js", "dist/fix/fix.compact.js", "ui/js/**/*.js", "!ui/js/fineui.i18n.js"],
dest: "dist/fineui.js"
},
6 years ago
fineuiIEJs: {
src: ["dist/polyfill.js", "dist/core.js", "dist/fix/fix.ie.js", "dist/base.js",
"dist/case.js", "dist/widget.js", "dist/router.js", "dist/fix/fix.compact.ie.js", "ui/js/**/*.js", "!ui/js/fineui.i18n.js"],
dest: "dist/fineui.ie.js"
},
6 years ago
fineuiWithoutJqueryAndPolyfillJs: {
src: ["src/core/foundation.js",
"src/core/lodash.js",
// 'src/core/mvc/**/*.js',
"src/core/base.js",
"src/core/ob.js",
"src/core/widget.js",
// 'src/core/model.js',
// 'src/core/view.js',
"src/core/shortcut.js",
"src/core/utils/*.js",
"src/core/behavior/behavior.js",
"src/core/wrapper/layout.js",
"src/core/plugin.js",
"src/core/**/*.js",
6 years ago
"!src/core/platform/web/**/*.js",
6 years ago
"src/data/data.js",
"src/data/**/*.js",
"dist/fix/fix.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/**/*.js",
6 years ago
"!src/base/tree/ztree/**/*.js",
6 years ago
"!src/base/single/input/file.js",
"src/case/combo/popup.bubble.js",
"src/case/**/*.js",
"!src/case/colorchooser/**/*.js",
6 years ago
"!src/case/tree/ztree/**/*.js",
6 years ago
6 years ago
"dist/widget.js", "dist/fix/fix.compact.js", "ui/js/**/*.js"],
6 years ago
dest: "dist/fineui_without_jquery_polyfill.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/foundation.js",
6 years ago
"src/core/lodash.js",
7 years ago
"src/core/var.js",
"src/core/func/array.js",
"src/core/func/number.js",
"src/core/func/string.js",
"src/core/func/date.js",
"src/core/func/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",
6 years ago
"utils/date.i18n.js",
6 years ago
"public/js/fineui.i18n.js",
7 years ago
"src/data/data.js",
"src/data/**/*.js"
7 years ago
],
6 years ago
dest: "dist/utils.js"
7 years ago
}
8 years ago
},
6 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: {
6 years ago
banner: "/*! <%= pkg.name %> <%= grunt.template.today(\"yyyy-mm-dd HH:MM:ss\") %> */\n"
8 years ago
},
dist: {
files: {
7 years ago
"dist/bundle.min.js": ["<%= concat.bundleJs.dest %>"],
6 years ago
"dist/bundle.ie.min.js": ["<%= concat.bundleIEJs.dest %>"],
6 years ago
"dist/utils.min.js": ["<%= concat.utilsJs.dest %>"],
6 years ago
"dist/fineui.min.js": ["<%= concat.fineuiJs.dest %>"],
"dist/fineui.ie.min.js": ["<%= concat.fineuiIEJs.dest %>"]
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
}
}
},
6 years ago
copy: {
js: {
files: [
{
expand: true,
cwd: "dist",
src: [
"fineui.js"
],
dest: "dist/",
rename: function (dest, src) {
return dest + src.replace(".js", ".min.js");
}
}
]
}
},
8 years ago
watch: {
scripts: {
6 years ago
files: ["src/**/*.js", "src/**/*.less", "demo/js/**/*.js", "demo/version.js", "demo/config.js", "demo/less/**/*.less"],
7 years ago
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
7 years ago
}
8 years ago
}
},
clean: ["src/css", "demo/css"]
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");
6 years ago
grunt.loadNpmTasks("grunt-contrib-clean");
6 years ago
grunt.loadNpmTasks("grunt-contrib-copy");
8 years ago
6 years ago
var defaultTask = ["clean", "less", "concat", "connect", "watch"];
6 years ago
grunt.registerTask("default", defaultTask);
grunt.registerTask("compile", function () {
grunt.config.set("connect.options.open", false);
grunt.task.run(defaultTask);
});
6 years ago
grunt.registerTask("build", ["clean", "less", "cssmin", "concat", "uglify"]);
6 years ago
grunt.registerTask("fake-build", ["clean", "less", "cssmin", "concat", "copy"]);
6 years ago
};