-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* jshint node: true */ | ||
module.exports = function (opts, callback) { | ||
"use strict"; | ||
|
||
opts = opts || {}; | ||
|
||
var grunt = require("grunt"); | ||
var fs = require("fs"); | ||
var cp = require("child_process"); | ||
|
||
var Gruntfile = require("../Gruntfile")(grunt); | ||
var settings = grunt.config(); | ||
|
||
var verbose = (opts.verbose !== false); | ||
delete opts.verbose; | ||
|
||
if (typeof opts !== "undefined") { | ||
var configPath = "./config-all.json"; | ||
|
||
if (fs.existsSync(configPath)) { | ||
var modernizrConfig = grunt.file.readJSON(configPath); | ||
|
||
for (var key in opts) { | ||
modernizrConfig[key] = opts[key]; | ||
} | ||
|
||
grunt.file.write(configPath, JSON.stringify(modernizrConfig, null, 2)); | ||
} | ||
} | ||
|
||
var build = cp.spawn("grunt", ["build"], { | ||
stdio: verbose ? "inherit" : [0, "pipe", 2] | ||
}); | ||
|
||
build.on("exit", function (code) { | ||
var uglify = settings.uglify || {}; | ||
var source = uglify.dist.src[0]; | ||
var dest = uglify.dist.dest; | ||
|
||
if (source && dest && typeof callback === "function") { | ||
callback.call(grunt, { | ||
code: grunt.file.read(source), | ||
min: grunt.file.read(dest) | ||
}); | ||
} | ||
|
||
process.exit(code); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* jshint node: true */ | ||
"use strict"; | ||
|
||
var grunt = require("grunt"); | ||
|
||
module.exports = { | ||
build: require("./build") | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters