Skip to content

Commit cbf03c7

Browse files
author
Shuwen Qian
committed
Add version to build
1 parent daf91db commit cbf03c7

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

Gulpfile.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function vulcanizeSingle(opts, baseList, basePath) {
162162
}
163163

164164
gulp.task('vulcanize', function() {
165-
var moduleGlob = j(C.BUILD,C.MODULE_MASK, C.MODULE_HTML);
165+
var moduleGlob = j(C.BUILD,C.MODULE_MASK, C.MODULE_HTML);
166166
var excludes = glob.sync(moduleGlob);
167167
excludes.push(j(C.BOWER, '/polymer/polymer.html'));
168168

@@ -188,15 +188,24 @@ gulp.task('vulcanize', function() {
188188
});
189189

190190
gulp.task('default', function(cb) {
191-
run('clean','copy',['sass','font'],'vulcanize',cb);
191+
run('clean','copy',['sass','font'],'lib-version','vulcanize',cb);
192192
});
193193

194194
gulp.task('build', function(cb) {
195-
run('copy',['sass','font'],'vulcanize',cb);
195+
run('copy',['sass','font'],'lib-version','vulcanize',cb);
196196
});
197197

198198
gulp.task('build:dist', function(cb) {
199-
run('clean','patch-lib', 'copy',['sass','font'], 'build:prod', cb);
199+
run('clean','patch-lib', 'copy',['sass','font'], 'lib-version','build:prod', cb);
200+
});
201+
202+
gulp.task('lib-version', function() {
203+
var pkg = getPkgInfo();
204+
var templatePath = j(C.TEMPLATES, '/lib_version.html');
205+
var templateString = fs.readFileSync(templatePath, 'utf8');
206+
var template = hogan.compile(templateString);
207+
var index = template.render(pkg);
208+
fs.writeFileSync(j(C.BUILD,'version.html'), index);
200209
});
201210

202211
gulp.task('build:prod', function() {
@@ -223,8 +232,7 @@ gulp.task('build:prod', function() {
223232
var lib = gulp.src(j(C.BUILD,'strand.html'))
224233
.pipe(vulcanize({
225234
inlineScripts: true,
226-
inlineCss: true,
227-
stripExcludes: []
235+
inlineCss: true
228236
}))
229237
.pipe(base64(['.woff']))
230238
.pipe(htmlmin({

src/strand.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<link rel="import" href="version.html">
12
<link rel="import" href="mm-action/mm-action.html">
23
<link rel="import" href="mm-ajax/mm-ajax.html">
34
<link rel="import" href="mm-autocomplete/mm-autocomplete.html">
@@ -42,4 +43,4 @@
4243
<link rel="import" href="mm-textarea/mm-textarea.html">
4344
<link rel="import" href="mm-tooltip/mm-tooltip.html">
4445
<link rel="import" href="mm-form/mm-form.html">
45-
<link rel="import" href="mm-repeater/mm-repeater.html">
46+
<link rel="import" href="mm-repeater/mm-repeater.html">

0 commit comments

Comments
 (0)