getsmap / smap-responsive

A JavaScript framework for simple creation of web maps with responsive design supporting a range of different browsers and devices
GNU General Public License v3.0
14 stars 12 forks source link

ES2015 complient import structure #233

Closed johanlahti closed 8 years ago

johanlahti commented 8 years ago

Our current import style is based on the old-style "globals". In our case, we prevent from polluting the global namespace by binding everything to only one global variable, smap. There are smarter ways of managing libraries, such as…

…where the latter is preferred, because it's a new JS standard and supports both sync and async imports.

Many libraries are today distributed supporting one, or all, of these import styles.

As a start, we should adapt our building script to at least support ES2015 in the plugins. This enables us to use the rest of the ES2015 features.

johanlahti commented 8 years ago

New gulp tasks implemented using webpack, which enables the features described in previous comment.

gulp watch:js  // -> Watches for changes in plugins' JS files and transpiles from ES2015 to ES5 using webpack (outputs to dist folder)
gulp ourjs    // -> Transpiles all plugins to ES5 and then merges with core's js