gulp-kissy-html2js
v0.0.2
Published
KISSY html2js
Downloads
3
Readme
KISSY html2js
###使用方法
var rename = require('gulp-rename');
var html2js = require('gulp-kissy-html2js');
gulp.task('html2js', function(){
return gulp.src('src/**/*.html')
.pipe(html2js({
prefix: '/tm/buy-m/',
rename: function (url){
url = url.replace('.html', '');
url += '-tmpl';
return url;
}
}))
.pipe(rename(function (path){
// path.dirname += "/ciao";
// path.basename += "-goodbye";
path.extname = '.js';
}))
.pipe(gulp.dest('build/'));
})
原文件:
<article id="J_BuyOrder" v-component="app" class="mb-anim-view-active mb-anim-view">
</article>
结果:
kissy.add('/tm/buy-m/components/app/app-tmpl', function (){
window.__TMPL__ = window.__TMPL__ || {};
var str = window.__TMPL__['/tm/buy-m/components/app/app-tmpl'] = '<article id="J_BuyOrder" v-component="app" class="mb-anim-view-active mb-anim-view">\n' +
'</article>';
return str;
});