snap.js/Gruntfile.js

91 lines
2.6 KiB
JavaScript
Raw Normal View History

2013-08-05 08:04:30 +00:00
module.exports = function(grunt) {
2017-01-24 02:32:41 +00:00
var pkg = grunt.file.readJSON("package.json"),
core = [
"./src/mina.js",
"./src/svg.js",
"./src/element.js",
"./src/animation.js",
"./src/matrix.js",
"./src/attr.js",
"./src/class.js",
"./src/attradd.js",
"./src/paper.js",
"./src/path.js",
"./src/set.js",
"./src/equal.js",
"./src/mouse.js",
"./src/filter.js",
"./src/align.js",
"./src/colors.js"
],
src = [
"./node_modules/eve/eve.js",
"./src/amd-banner.js",
"./src/amd-footer.js"
];
2013-08-05 08:04:30 +00:00
2017-01-24 02:32:41 +00:00
src.splice(2, 0, core);
2013-08-05 08:04:30 +00:00
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: pkg,
2013-09-02 04:26:51 +00:00
banner: grunt.file.read("./src/copy.js")
2013-08-05 08:04:30 +00:00
.replace(/@VERSION/, pkg.version)
.replace(/@DATE/, grunt.template.today("yyyy-mm-dd")) + "\n",
// Task configuration.
uglify: {
options: {
banner: "<%= banner %>",
report: "min"
},
dist: {
src: "<%= concat.target.dest %>",
2013-10-29 01:13:58 +00:00
dest: "dist/snap.svg-min.js"
2013-08-05 08:04:30 +00:00
}
},
concat: {
options: {
banner: "<%= banner %>"
},
target: {
2013-10-29 01:13:58 +00:00
dest: "dist/snap.svg.js",
2017-01-24 02:32:41 +00:00
src: src
2013-08-05 08:04:30 +00:00
}
},
exec: {
dr: {
command: "node node_modules/dr.js/dr dr.json"
2017-01-24 02:32:41 +00:00
},
2017-02-03 00:41:35 +00:00
test: {
command: "cd test; phantomjs test.js"
},
2017-01-24 02:32:41 +00:00
eslint: {
command: "./node_modules/eslint/bin/eslint.js " + core.join(" ")
},
2017-02-03 11:19:22 +00:00
},
prettify: {
options: {
indent: 4,
indent_char: " ",
wrap_line_length: 80,
brace_style: "expand",
unformatted: ["code", "pre", "script"]
},
one: {
src: "./doc/reference.html",
dest: "./doc/reference.html"
}
2013-08-05 08:04:30 +00:00
}
});
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-exec");
2017-02-03 11:19:22 +00:00
grunt.loadNpmTasks("grunt-prettify");
2013-08-05 08:04:30 +00:00
2017-02-03 11:19:22 +00:00
grunt.registerTask("default", ["exec:eslint", "concat", "uglify", "exec:dr", "prettify"]);
2017-01-24 02:32:41 +00:00
grunt.registerTask("lint", ["exec:eslint"]);
2017-02-03 00:41:35 +00:00
grunt.registerTask("test", ["exec:test"]);
};