https://github.com/reon90/babel-tung
Babeljs plugin for tung templates.
https://github.com/reon90/babel-tung
Last synced: 3 months ago
JSON representation
Babeljs plugin for tung templates.
- Host: GitHub
- URL: https://github.com/reon90/babel-tung
- Owner: Reon90
- License: mit
- Created: 2017-04-07T21:52:09.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-08T14:32:56.000Z (over 9 years ago)
- Last Synced: 2025-04-11T00:58:59.925Z (over 1 year ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# babel-tung
Babel plugin for [tung](https://github.com/Reon90/tung).
## Install
```
npm install babel-tung
```
## Usage
### Webpack 2
```js
module.exports = {
entry: './app/app.js',
output: {
filename: 'bundle.js',
path: './dist'
},
module: {
loaders: [{
test: /.tpl?$/,
loader: 'babel-loader?filename=[name]',
options: {
babelrc: false, plugins: "babel-tung"
}
}]
},
};
```
### Gulp
```js
const gulp = require('gulp');
const babel = require("babel-core");
const transform = require('gulp-transform');
const rename = require('gulp-rename');
gulp.task('tpl', () => {
return gulp.src('assets/html/**/*.tpl')
.pipe(transform((content, file) => {
return babel.transform(content, { babelrc: false, filename: file.basename.replace('.tpl', ''), plugins: "babel-tung" }).code;
}))
.pipe(rename({
extname: ".js"
}))
.pipe(gulp.dest('dist/html'));
});
```