diff options
author | James Friend <james.friend@agworld.com.au> | 2014-08-28 05:39:41 +0400 |
---|---|---|
committer | James Friend <james.friend@agworld.com.au> | 2014-08-28 05:39:41 +0400 |
commit | 015ee2ed74bcdc48eea9bb7f6bb453f1c2f182aa (patch) | |
tree | 5388c7206375ba5b69b31ef70da0803a97d0e392 /grunt | |
parent | 9aeaf19b1dca68ee71e916ae415a0c270a47d301 (diff) |
pulled output path out to gruntfile
Diffstat (limited to 'grunt')
-rw-r--r-- | grunt/bs-commonjs-generator.js | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/grunt/bs-commonjs-generator.js b/grunt/bs-commonjs-generator.js index 0a76333d92..8ab309b332 100644 --- a/grunt/bs-commonjs-generator.js +++ b/grunt/bs-commonjs-generator.js @@ -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); } |