An open API service indexing awesome lists of open source software.

https://github.com/webengage/babel-plugin-template-string-transform

Babel plugin (experimental :skull:) to transform ES6 template strings before compilation to ES5
https://github.com/webengage/babel-plugin-template-string-transform

Last synced: 4 days ago
JSON representation

Babel plugin (experimental :skull:) to transform ES6 template strings before compilation to ES5

Awesome Lists containing this project

README

          

# babel-plugin-template-string-transform

### Install
```
npm install --save html-minifier cssmin

npm install --save WebEngage/babel-plugin-template-string-transform
```

### Use

build.js
```js
var babel = require('babel-core')

var transformed = babel.transform('code();', {
plugins: [
[
'template-string-transform',
{
htmlmin : require('babel-plugin-template-string-transform/transforms/minify-html'),
cssmin : require('babel-plugin-template-string-transform/transforms/minify-css')
}
]
],
presets: ['es2015']
})

...
```

source.js
```js
var Layout = {
getMarkup: function (data) {
return htmlmin`






`
},
getStyles: function (data) {
return cssmin`
div#cta a {
color: ${data.linkColor};
}
`
}
}
```