source: trip-planner-front/node_modules/bootstrap/grunt/bs-commonjs-generator.js@ fa375fe

Last change on this file since fa375fe was fa375fe, checked in by Ema <ema_spirova@…>, 3 years ago

adding new components

  • Property mode set to 100644
File size: 978 bytes
Line 
1/*!
2 * Bootstrap Grunt task for the CommonJS module generation
3 * https://getbootstrap.com/
4 * Copyright 2014-2019 Twitter, Inc.
5 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
6 */
7
8'use strict';
9
10var fs = require('fs');
11var path = require('path');
12
13var COMMONJS_BANNER = '// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.\n';
14
15module.exports = function generateCommonJSModule(grunt, srcFiles, destFilepath) {
16 var destDir = path.dirname(destFilepath);
17
18 function srcPathToDestRequire(srcFilepath) {
19 var requirePath = path.posix.relative(destDir, srcFilepath);
20 return 'require(\'' + requirePath + '\')';
21 }
22
23 var moduleOutputJs = COMMONJS_BANNER + srcFiles.map(srcPathToDestRequire).join('\n');
24 try {
25 fs.writeFileSync(destFilepath, moduleOutputJs);
26 } catch (err) {
27 grunt.fail.warn(err);
28 }
29 grunt.log.writeln('File ' + destFilepath.cyan + ' created.');
30};
Note: See TracBrowser for help on using the repository browser.