Support release of templates/assets/built-files

This commit is contained in:
Addy Osmani 2015-06-30 14:02:35 +01:00
parent 9c44638246
commit 79f09f850a
2 changed files with 26 additions and 5 deletions

View File

@ -470,11 +470,31 @@ gulp.task('zip:mdl', function() {
.pipe(gulp.dest('dist'));
});
// Generate release archive containing the library and templates
// Generate release archive containing the library, templates and assets
// for templates. Note that it is intentional for some templates to include
// a customised version of the material.min.css file for their own needs.
// Others (e.g the Android template) simply use the default built version of
// the library.
// Define a filter containing only the build assets we want to pluck from the
// `dist` stream. This enables us to preserve the correct final dir structure,
// which was not occurring when simply using `gulp.src` in `zip:templates`
var fileFilter = $.filter([
'material.*@(js|css)?(.map)',
'templates/**/*.*',
'assets/**/*.*',
'LICENSE',
'bower.json',
'package.json']);
gulp.task('zip:templates', function() {
gulp.src(['dist/**/*', 'LICENSE', 'bower.json', 'package.json'])
.pipe($.zip('mdl-all.zip'))
.pipe(gulp.dest('dist'));
// Stream of all `dist` files and other package manager files from root
gulp.src(['dist/**/*.*', 'LICENSE', 'bower.json', 'package.json'])
.pipe(fileFilter)
.pipe($.zip('mdl-templates.zip'))
.pipe(fileFilter.restore())
.pipe(gulp.dest('dist'));
});
// Push the latest version of code resources (CSS+JS) to Google Cloud Storage.
@ -502,7 +522,7 @@ gulp.task('publish:code', ['zip:mdl', 'zip:templates'], function() {
// Upload the goodies to a separate GCS bucket with versioning.
// Using a sep bucket avoids the risk of accidentally blowing away
// old versions in the microsite bucket.
return gulp.src(['dist/material.*@(js|css)?(.map)', 'dist/mdl.zip', 'dist/mdl-all.zip'],
return gulp.src(['dist/material.*@(js|css)?(.map)', 'dist/mdl.zip', 'dist/mdl-templates.zip'],
{read: false})
.pipe($.tap(function(file, t) {
file.base = path.basename(file.path);

View File

@ -26,6 +26,7 @@
"gulp-connect": "^2.2.0",
"gulp-css-inline-images": "^0.1.1",
"gulp-csso": "^1.0.0",
"gulp-filter": "^2.0.2",
"gulp-flatten": "0.0.4",
"gulp-front-matter": "^1.2.2",
"gulp-gh-pages": "^0.5.0",