1.2.3 • Published 7 years ago
@haiker/x.template v1.2.3
x.template
gulp template plugins 一个优雅的模板
Installation
$ npm install x.template --saveUsage
var gulp = require('gulp');
gulp.import = require('x.template');Example
In your gulpfile.js:
var gulp = require('gulp'),
xImport = require('x.import');
gulp.task('html', function () {
gulp.src(['./src/**/*.html', '!./src/layouts/*.html'])
.pipe(template({ "template":"./src/layouts/template.html"}, {"title": "An elegant template"}))
.pipe(gulp.dest('build'));
});In your ./src/layouts/template.html
<html>
<head>
<title><%=title%></title>
<%=header%>
</head>
<body>
<div class="content">
<%=body%>
</div>
<%=scripts%>
</body>
</html>In your *.html
There is no example here, just follow the usual way.
License
Apache License 2.0
history
- v1.2.0
in your
*.htmladdxargstag, This tag is used to set parameters<xargs key="arg" value="atrValue"/> or <xargs key="arg">bodyValue</xargs> v1.1.0
in your
*.htmlbodytag addtemplatetag<xtemplate src="layout/modal.html" title="the value of param named title"> the body </xtemplate>layouts/modal.html<div class="modal"> <div class="title"><%=title%></div> <div class="content"> <%=body%> </div> </div>write html
<div class="modal"> <div class="title">the value of param named title</div> <div class="content"> the body </div> </div>