Skip to content

Commit

Permalink
#66 Make code better by @blond advices
Browse files Browse the repository at this point in the history
  • Loading branch information
tormozz48 committed Aug 17, 2015
1 parent cd842d4 commit 109a011
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions techs/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,39 +68,43 @@ module.exports = require('enb/lib/build-flow').create()
version: parsed.version,
language: this._lang,
exports: this._exports
};
},
commonJS = opts.exports.commonJS || '',
ym = opts.exports.ym || '',
globals = opts.exports.globals || '',
isForcedGlobalExports = opts.exports.globals === 'force';

return [
'(function (global) {',
' var __i18n__ = ' + compile(parsed.core, parsed.keysets, opts) + ',',
' defineAsGlobal = true;',
'',
' // CommonJS',
opts.exports.commonJS ? [
commonJS && [
' // CommonJS',
' if (typeof exports === "object") {',
' module.exports = __i18n__;',
opts.exports.globals === 'force' ? '' :
isForcedGlobalExports === 'force' ? '' :
' defineAsGlobal = false;',
' }'
].join(EOL) : '',
].join(EOL),
'',
' // YModules',
opts.exports.ym ? [
ym && [
' // YModules',
' if (typeof modules === "object") {',
' modules.define("i18n", function (provide) {',
' provide(__i18n__);',
' });',
opts.exports.globals === 'force' ? '' :
isForcedGlobalExports === 'force' ? '' :
' defineAsGlobal = false;',
' }'
].join(EOL) : '',
].join(EOL),
'',
opts.exports.globals ? [
globals && [
' if (defineAsGlobal) {',
' global.BEM || (global.BEM = {});',
' global.BEM.I18N = __i18n__;',
' }'
].join(EOL) : '',
].join(EOL),
'})(this);'
].join(EOL);
}, this);
Expand Down

0 comments on commit 109a011

Please sign in to comment.