Grunt: normalize build paths

The sourcemaps included build/openseadragon/ in the paths. Since grunt
lacks a standard way to replace text in files, I semi-randomly picked
grunt-text-replace.
This commit is contained in:
Chris Adams 2013-04-09 14:44:08 -04:00
parent ae881689ec
commit b87de8e6c6
2 changed files with 17 additions and 2 deletions

View File

@ -10,6 +10,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-contrib-watch"); grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-clean"); grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-git-describe"); grunt.loadNpmTasks("grunt-git-describe");
grunt.loadNpmTasks('grunt-text-replace');
// ---------- // ----------
var packageJson = grunt.file.readJSON("package.json"), var packageJson = grunt.file.readJSON("package.json"),
@ -77,6 +78,18 @@ module.exports = function(grunt) {
dest: distribution dest: distribution
} }
}, },
replace: {
cleanPaths: {
src: ['build/openseadragon/*.map'],
overwrite: true,
replacements: [
{
from: /build\/openseadragon\//g,
to: ''
}
]
}
},
uglify: { uglify: {
options: { options: {
preserveComments: "some", preserveComments: "some",
@ -196,7 +209,8 @@ module.exports = function(grunt) {
// Build task. // Build task.
// Cleans out the build folder and builds the code and images into it, checking lint. // Cleans out the build folder and builds the code and images into it, checking lint.
grunt.registerTask("build", [ grunt.registerTask("build", [
"clean:build", "jshint:beforeconcat", "git-describe", "concat", "jshint:afterconcat", "uglify", "copy:build" "clean:build", "jshint:beforeconcat", "git-describe", "concat", "jshint:afterconcat",
"uglify", "replace:cleanPaths", "copy:build"
]); ]);
// ---------- // ----------

View File

@ -12,7 +12,8 @@
"grunt-contrib-connect": "~0.1.2", "grunt-contrib-connect": "~0.1.2",
"grunt-contrib-watch": "~0.2.0", "grunt-contrib-watch": "~0.2.0",
"grunt-contrib-clean": "~0.4.0", "grunt-contrib-clean": "~0.4.0",
"grunt-git-describe": "~2.0.0" "grunt-git-describe": "~2.0.0",
"grunt-text-replace": "~0.3.2"
}, },
"scripts": { "scripts": {
"test": "grunt test" "test": "grunt test"