mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-17 09:52:29 +01:00
pulled output path out to gruntfile
This commit is contained in:
parent
9aeaf19b1d
commit
015ee2ed74
@ -438,7 +438,7 @@ module.exports = function (grunt) {
|
||||
grunt.registerTask('test', testSubtasks);
|
||||
|
||||
// JS distribution task.
|
||||
grunt.registerTask('dist-js', ['concat', 'uglify:core']);
|
||||
grunt.registerTask('dist-js', ['concat', 'uglify:core', 'commonjs']);
|
||||
|
||||
// CSS distribution task.
|
||||
grunt.registerTask('less-compile', ['less:compileCore', 'less:compileTheme']);
|
||||
@ -464,8 +464,9 @@ module.exports = function (grunt) {
|
||||
});
|
||||
|
||||
grunt.registerTask('commonjs', 'Generate CommonJS entrypoint module in dist dir.', function () {
|
||||
var files = grunt.config.get('concat.bootstrap.src');
|
||||
generateCommonJSModule(grunt, files);
|
||||
var srcFiles = grunt.config.get('concat.bootstrap.src');
|
||||
var destFilepath = 'dist/js/npm.js';
|
||||
generateCommonJSModule(grunt, srcFiles, destFilepath);
|
||||
});
|
||||
|
||||
// Docs task.
|
||||
|
@ -2,17 +2,16 @@
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
var destDir = 'dist/js';
|
||||
var destFilename = 'npm.js';
|
||||
var destFilepath = path.join(destDir, destFilename);
|
||||
module.exports = function generateCommonJSModule(grunt, srcFiles, destFilepath) {
|
||||
var destDir = path.dirname(destFilepath);
|
||||
|
||||
function srcPathToDestRequire(srcFilepath) {
|
||||
var requirePath = path.relative(destDir, srcFilepath);
|
||||
return "require('"+requirePath+"')";
|
||||
}
|
||||
function srcPathToDestRequire(srcFilepath) {
|
||||
var requirePath = path.relative(destDir, srcFilepath);
|
||||
return "require('"+requirePath+"')";
|
||||
}
|
||||
|
||||
module.exports = function generateCommonJSModule(grunt, files) {
|
||||
var moduleOutputJs = files.map(srcPathToDestRequire).join('\n');
|
||||
var moduleOutputJs = srcFiles.map(srcPathToDestRequire).join('\n');
|
||||
|
||||
try {
|
||||
fs.writeFileSync(destFilepath, moduleOutputJs);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user