Skip to content

Commit

Permalink
Added WebPack2
Browse files Browse the repository at this point in the history
This actually makes the JS bundler significantly bigger (170KB), but WebPack2 is the actively maintained
version and they are working on implementing further optimisations (see https://webpack.js.org/vote/ )
  • Loading branch information
Daniel Rey Lopez committed Feb 19, 2017
1 parent 28d9b62 commit ccfb169
Show file tree
Hide file tree
Showing 7 changed files with 628 additions and 317 deletions.
6 changes: 3 additions & 3 deletions client/lib/calypso-boot/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ReactClass from 'react/lib/ReactClass';
import i18n from '../mixins/i18n';
import { initialize, mixin } from '../mixins/i18n';

export default function boot() {
// Initialize i18n
Expand All @@ -9,9 +9,9 @@ export default function boot() {
i18nLocaleStringsObject = window.i18nLocaleStrings;
}

i18n.initialize( i18nLocaleStringsObject );
initialize( i18nLocaleStringsObject );

ReactClass.injection.injectMixin( i18n.mixin );
ReactClass.injection.injectMixin( mixin );
}

boot();
12 changes: 3 additions & 9 deletions client/lib/mixins/i18n/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,14 @@
// as implement our own translation logic, that could involved the server.
let translations = {};

const initialize = ( newTranslations ) => {
export const initialize = ( newTranslations ) => {
translations = newTranslations;
};

const translate = ( text ) => {
export const translate = ( text ) => {
return ( text in translations ) ? translations[ text ] : text;
};

const mixin = {
export const mixin = {
translate,
};

export default {
initialize,
translate,
mixin,
};
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = function( config ) {
{ type: 'text-summary' },
]
},
webpack: Object.assign( baseWebpackConfig, {
webpack: Object.assign( baseWebpackConfig(), {
entry: {},
isparta: {
embedSource: true,
Expand Down
Loading

0 comments on commit ccfb169

Please sign in to comment.