mirror of
https://github.com/mdbootstrap/mdb-ui-kit.git
synced 2024-11-27 03:54:13 +03:00
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
|
|
}
|
|
}())
|
|
|