2013-02-13 07:40:08 +04:00
|
|
|
module.exports = function(grunt) {
|
2013-02-15 22:58:57 +04:00
|
|
|
|
|
|
|
grunt.loadNpmTasks("grunt-contrib-compress");
|
|
|
|
|
2013-02-14 22:21:35 +04:00
|
|
|
var distribution = "build/openseadragon.js",
|
|
|
|
minified = "build/openseadragon.min.js",
|
2013-02-13 07:40:08 +04:00
|
|
|
sources = [
|
|
|
|
"src/openseadragon.js",
|
|
|
|
"src/eventhandler.js",
|
|
|
|
"src/mousetracker.js",
|
|
|
|
"src/control.js",
|
|
|
|
"src/controldock.js",
|
|
|
|
"src/viewer.js",
|
|
|
|
"src/navigator.js",
|
|
|
|
"src/strings.js",
|
|
|
|
"src/point.js",
|
|
|
|
//"src/profiler.js",
|
|
|
|
"src/tilesource.js",
|
|
|
|
"src/dzitilesource.js",
|
|
|
|
"src/iiiftilesource.js",
|
|
|
|
"src/osmtilesource.js",
|
|
|
|
"src/tmstilesource.js",
|
|
|
|
"src/legacytilesource.js",
|
|
|
|
"src/tilesourcecollection.js",
|
|
|
|
"src/button.js",
|
|
|
|
"src/buttongroup.js",
|
|
|
|
"src/rectangle.js",
|
|
|
|
"src/referencestrip.js",
|
|
|
|
"src/displayrectangle.js",
|
|
|
|
"src/spring.js",
|
|
|
|
"src/tile.js",
|
|
|
|
"src/overlay.js",
|
|
|
|
"src/drawer.js",
|
|
|
|
"src/viewport.js"
|
|
|
|
];
|
|
|
|
|
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
2013-02-15 00:02:17 +04:00
|
|
|
pkg: "<json:package.json>",
|
|
|
|
meta: {
|
|
|
|
banner: "/**\n * @version <%= pkg.name %> <%= pkg.version %>\n */"
|
|
|
|
},
|
2013-02-13 07:40:08 +04:00
|
|
|
concat: {
|
|
|
|
dist: {
|
2013-02-15 00:02:17 +04:00
|
|
|
src: [ "<banner>" ].concat(sources),
|
2013-02-13 07:40:08 +04:00
|
|
|
dest: distribution
|
|
|
|
}
|
|
|
|
},
|
2013-02-14 22:21:35 +04:00
|
|
|
min: {
|
|
|
|
openseadragon: {
|
|
|
|
src: [ distribution ],
|
|
|
|
dest: minified
|
|
|
|
}
|
|
|
|
},
|
2013-02-15 22:58:57 +04:00
|
|
|
compress: {
|
|
|
|
zip: {
|
|
|
|
files: {
|
|
|
|
"openseadragon.zip": "build/**"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
tar: {
|
|
|
|
files: {
|
|
|
|
"openseadragon.tar": "build/**"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2013-02-14 22:21:35 +04:00
|
|
|
qunit: {
|
|
|
|
all: [ "http://localhost:8000/test/test.html" ]
|
|
|
|
},
|
|
|
|
server: {
|
|
|
|
port: 8000,
|
|
|
|
base: "."
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
files: [ "grunt.js", "src/*.js" ],
|
|
|
|
tasks: "default"
|
|
|
|
},
|
2013-02-13 07:40:08 +04:00
|
|
|
lint: {
|
|
|
|
beforeconcat: sources,
|
|
|
|
afterconcat: [ distribution ]
|
|
|
|
},
|
|
|
|
jshint: {
|
|
|
|
options: {
|
|
|
|
browser: true,
|
|
|
|
eqeqeq: false,
|
|
|
|
loopfunc: false
|
|
|
|
/*curly: true,
|
|
|
|
eqeqeq: true,
|
|
|
|
immed: true,
|
|
|
|
latedef: true,
|
|
|
|
newcap: true,
|
|
|
|
noarg: true,
|
|
|
|
sub: true,
|
|
|
|
undef: true,
|
|
|
|
eqnull: true,*/
|
|
|
|
},
|
|
|
|
globals: {
|
|
|
|
OpenSeadragon: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-02-15 01:24:50 +04:00
|
|
|
// Copy task.
|
|
|
|
grunt.registerTask("copy", function() {
|
|
|
|
grunt.file.recurse("images", function(abspath, rootdir, subdir, filename) {
|
|
|
|
grunt.file.copy(abspath, "build/images/" + (subdir || "") + filename);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2013-02-13 07:40:08 +04:00
|
|
|
// Default task.
|
2013-02-15 01:24:50 +04:00
|
|
|
grunt.registerTask("default", "lint:beforeconcat concat lint:afterconcat min copy");
|
2013-02-14 22:21:35 +04:00
|
|
|
|
|
|
|
// Test task.
|
|
|
|
grunt.registerTask("test", "default server qunit");
|
2013-02-13 07:40:08 +04:00
|
|
|
|
2013-02-15 22:58:57 +04:00
|
|
|
// Package task.
|
|
|
|
grunt.registerTask("package", "default compress");
|
2013-02-14 22:21:35 +04:00
|
|
|
};
|