mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
Added node-modules
This commit is contained in:
47
node_modules/moment/tasks/concat-lang.js
generated
vendored
Normal file
47
node_modules/moment/tasks/concat-lang.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
/*jshint onevar:false*/
|
||||
|
||||
module.exports = function (grunt) {
|
||||
|
||||
var helpers = require('grunt-lib-legacyhelpers').init(grunt);
|
||||
var START = "(function(){\n";
|
||||
var END = "})();\n";
|
||||
|
||||
var GLOBAL_START = [
|
||||
"(function(){",
|
||||
" function onload (moment) {",
|
||||
""
|
||||
].join('\n');
|
||||
|
||||
var GLOBAL_RESET = "\nmoment.lang('en');\n";
|
||||
|
||||
var GLOBAL_END = [
|
||||
"",
|
||||
" }",
|
||||
" if (typeof define === \"function\" && define.amd) {",
|
||||
" define([\"moment\"], onload);",
|
||||
" }",
|
||||
" if (typeof window !== \"undefined\" && window.moment) {",
|
||||
" onload(window.moment);",
|
||||
" }",
|
||||
"})();",
|
||||
""
|
||||
].join('\n');
|
||||
|
||||
grunt.registerMultiTask('concatlang', 'Concatenate files.', function() {
|
||||
var files = grunt.file.expand(this.data.src);
|
||||
// Concat specified files.
|
||||
var src = helpers.concat(files, {separator: END + START});
|
||||
grunt.file.write(this.data.dest, wrapFile(src));
|
||||
|
||||
// Fail task if errors were logged.
|
||||
if (this.errorCount) { return false; }
|
||||
|
||||
// Otherwise, print a success message.
|
||||
grunt.log.writeln('File "' + this.data.dest + '" created.');
|
||||
});
|
||||
|
||||
function wrapFile(code) {
|
||||
code = code.replace(/require\([\'\"]\.\.\/moment[\'\"]\)/g, "moment");
|
||||
return GLOBAL_START + START + code + END + GLOBAL_RESET + GLOBAL_END;
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user