mirror of
https://github.com/mdbootstrap/mdb-ui-kit.git
synced 2024-11-23 10:04:04 +03:00
0835304d9f
- <module type>.js (uses subordinate require or imports) - <module type>-all.js (concat version of all subordinates) - <module type>-all.min.js minified all version. In addition, don't forget that the source es6 is also available. Docs aren't done yet or integrated.
46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
module.exports = (function () {
|
|
'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';
|
|
|
|
var commonJs = function (grunt, srcFiles, destFilepath) {
|
|
function moduleRequireStatement(srcFilepath) {
|
|
return 'require(\'' + srcFilepath.replace(/\\/g, '/') + '\')';
|
|
}
|
|
|
|
var moduleOutputJs = COMMONJS_BANNER + srcFiles.map(moduleRequireStatement).join('\n');
|
|
try {
|
|
fs.writeFileSync(destFilepath, moduleOutputJs);
|
|
} catch (err) {
|
|
grunt.fail.warn(err);
|
|
}
|
|
grunt.log.writeln('File ' + destFilepath.cyan + ' created.');
|
|
}
|
|
|
|
|
|
var SYSTEMJS_BANNER = '// This file is autogenerated via the `systemjs` Grunt task. You can import this file in a SystemJS environment.\n';
|
|
|
|
var systemJs = function (grunt, srcFiles, destFilepath) {
|
|
function moduleRequireStatement(srcFilepath) {
|
|
return 'System.import(\'' + srcFilepath.replace(/\\/g, '/') + '\')';
|
|
}
|
|
|
|
var moduleOutputJs = SYSTEMJS_BANNER + srcFiles.map(moduleRequireStatement).join('\n');
|
|
try {
|
|
fs.writeFileSync(destFilepath, moduleOutputJs);
|
|
} catch (err) {
|
|
grunt.fail.warn(err);
|
|
}
|
|
grunt.log.writeln('File ' + destFilepath.cyan + ' created.');
|
|
}
|
|
|
|
return {
|
|
'commonJs': commonJs,
|
|
'systemJs': systemJs
|
|
}
|
|
}())
|
|
|