postmask-babel
v1.1.16
Published
Babel optimizer for postmask
Downloads
15
Readme
PostMask Babel Compiler
Compiles functions in mask
templates to es5
Configurate
mask.cfg('postmask-babel', BabelOptions);
Default:
{"presets":["es2015"], plugins: [""external-helpers""]}
You should also include babelHelpers
to the app:
npm i -g babel-cli
babel-external-helpers -t var > my-babel-helpers.js
<script type="text/javascript" src="/path/my-babel-helpers.js"></script>
Optimizer
Defines optimizers to compile functions, slots, and other scripts to es5. Can be used as standalone module, but also as a plugin for postmask
.
atma-loader-postmask
$ npm i atma -g
$ atma plugin install atma-loader-postmast --save-dev
package.json
{
...
"atma-loader-postmask": {
"plugins": [
"postmask-babel",
"postmask-less"
],
"configs":{
"postmask-babel": BabelOptions
}
}
...
}
Runtime
Transform scripts at runtime. Use this only in some demos and in dev, not for production.
Usage
npm i babel-standalone --save-dev
npm i postmask-babel --save-dev
npm i maskjs --save
<script src="/node_modules/babel-standalone/babel.min.js"></script>
<script src="/node_modules/maskjs/lib/mask.js"></script>
<script src="/node_modules/postmask-babel/runtime.js"></script>
define Foo {
function onRenderStart () {
this.$.someWidget({
onUpdate (...args) {
console.log('foo')
}
});
}
}
(c) MIT License - Atma.js Project