snap.js/Gruntfile.js

73 lines
2.0 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
},
eslint: {
command: "./node_modules/eslint/bin/eslint.js " + core.join(" ")
},
2013-08-05 08:04:30 +00:00
}
});
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-exec");
2013-08-05 08:04:30 +00:00
2017-01-24 02:32:41 +00:00
grunt.registerTask("default", ["exec:eslint", "concat", "uglify", "exec:dr"]);
grunt.registerTask("lint", ["exec:eslint"]);
};