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
- Host: GitHub
- URL: https://github.com/webengage/babel-plugin-template-string-transform
- Owner: WebEngage
- Created: 2016-03-18T13:18:55.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-12T09:50:30.000Z (almost 10 years ago)
- Last Synced: 2025-03-04T14:49:13.092Z (about 1 year ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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};
}
`
}
}
```