summaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/grunt/bs-commonjs-generator.js
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2017-05-03 21:31:58 +0000
committerGerrit Code Review <gerrit@onap.org>2017-05-03 21:31:58 +0000
commita330af579866dacbe595e2e4ad1dd29cd3c96945 (patch)
treeb9455591600034dfd4f33a9c1f733336280f2208 /POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/grunt/bs-commonjs-generator.js
parent5444e748b8651d8346dcb78c5ab8b0637dea197b (diff)
parente0addf5b588a1244f9679becd90999dfcb4c3a94 (diff)
Merge "Policy 1707 commit to LF"
Diffstat (limited to 'POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/grunt/bs-commonjs-generator.js')
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/grunt/bs-commonjs-generator.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/grunt/bs-commonjs-generator.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/grunt/bs-commonjs-generator.js
new file mode 100644
index 000000000..b0642cd8f
--- /dev/null
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/grunt/bs-commonjs-generator.js
@@ -0,0 +1,23 @@
+'use strict';
+var fs = require('fs');
+var path = require('path');
+
+var COMMONJS_BANNER = '// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.\n';
+
+module.exports = function generateCommonJSModule(grunt, srcFiles, destFilepath) {
+ var destDir = path.dirname(destFilepath);
+
+ function srcPathToDestRequire(srcFilepath) {
+ var requirePath = path.relative(destDir, srcFilepath).replace(/\\/g, '/');
+ return 'require(\'' + requirePath + '\')';
+ }
+
+ var moduleOutputJs = COMMONJS_BANNER + srcFiles.map(srcPathToDestRequire).join('\n');
+ try {
+ fs.writeFileSync(destFilepath, moduleOutputJs);
+ }
+ catch (err) {
+ grunt.fail.warn(err);
+ }
+ grunt.log.writeln('File ' + destFilepath.cyan + ' created.');
+};