From e0addf5b588a1244f9679becd90999dfcb4c3a94 Mon Sep 17 00:00:00 2001 From: "ITSERVICES\\rb7147" Date: Tue, 25 Apr 2017 11:46:00 -0400 Subject: Policy 1707 commit to LF Change-Id: Ibe6f01d92f9a434c040abb05d5386e89d675ae65 Signed-off-by: ITSERVICES\rb7147 --- .../CSS/bootstrap/grunt/bs-commonjs-generator.js | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/grunt/bs-commonjs-generator.js (limited to 'POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/grunt/bs-commonjs-generator.js') 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.'); +}; -- cgit 1.2.3-korg