@@ -14,6 +14,7 @@ var vulcanize = require('gulp-vulcanize');
1414var debug = require ( 'gulp-debug' ) ;
1515var run = require ( 'run-sequence' ) ;
1616var htmlmin = require ( 'gulp-minify-html' ) ;
17+ var inlinemin = require ( 'gulp-minify-inline' ) ;
1718var wrap = require ( 'gulp-wrap' ) ;
1819var inlineAssets = require ( 'gulp-inline-assets' ) ;
1920var marked = require ( 'gulp-marked' ) ;
@@ -22,6 +23,9 @@ var es = require('event-stream');
2223var cache = require ( 'gulp-cached' ) ;
2324var postcss = require ( 'gulp-postcss' ) ;
2425var autoprefixer = require ( 'autoprefixer' ) ;
26+ var git = require ( 'gulp-git' ) ;
27+ var bump = require ( 'gulp-bump' ) ;
28+ var tag_version = require ( 'gulp-tag-version' ) ;
2529
2630var SRC = 'src/' ;
2731var BUILD = 'build/' ;
@@ -50,7 +54,7 @@ gulp.task('sass', function() {
5054 . pipe ( sass ( { includePaths : [ './bower_components/bourbon/app/assets/stylesheets/' , './src/shared/sass/' ] } ) . on ( 'error' , sass . logError ) )
5155 . pipe ( postcss ( [ autoprefixer ( { browsers : [ 'last 2 versions' ] } ) ] ) )
5256 . pipe ( gulp . dest ( BUILD ) )
53- // .pipe(wrap({src:TEMPLATES + "style_module_template.html"},{},{engine:"hogan"}))
57+ . pipe ( wrap ( { src :TEMPLATES + "style_module_template.html" } , { } , { engine :"hogan" } ) )
5458 . pipe ( wrap ( function ( data ) {
5559 data . fname = path . basename ( data . file . relative , '.css' ) ;
5660 return wrapper ;
@@ -79,11 +83,7 @@ gulp.task('vulcanize', function() {
7983 imports : [ '.*polymer\.html' ]
8084 }
8185 } ) )
82- . pipe ( htmlmin ( {
83- quotes : true ,
84- empty : true ,
85- spare : true
86- } ) )
86+ . pipe ( htmlmin ( ) )
8787 . pipe ( gulp . dest ( BUILD ) ) ;
8888 var lib = gulp . src ( BUILD + "strand.html" )
8989 . pipe ( vulcanize ( {
@@ -106,21 +106,45 @@ gulp.task('build', function(cb) {
106106 run ( 'copy' , [ 'sass' , 'font' ] , 'vulcanize' , cb ) ;
107107} ) ;
108108
109+ gulp . task ( 'build:prod' , function ( cb ) {
110+ run ( 'clean' , [ 'build' , 'vulcanize:prod' , 'copy:prod' ] , cb ) ;
111+ } ) ;
112+
109113gulp . task ( 'vulcanize:prod' , function ( ) {
110- return gulp . src ( BUILD + "mm-*/mm-* .html" )
114+ return gulp . src ( BUILD + 'strand .html' )
111115 . pipe ( vulcanize ( {
112- inlineScripts :true ,
113- inlineCss :true ,
114- stripExcludes :false
116+ inlineScripts :true ,
117+ inlineCss :true ,
118+ stripExcludes :false
115119 } ) )
116120 . pipe ( htmlmin ( {
117121 quotes : true ,
118122 empty : true ,
119123 spare : true
120124 } ) )
125+ . pipe ( inlinemin ( ) )
121126 . pipe ( gulp . dest ( BUILD ) ) ;
122127} ) ;
123128
129+ gulp . task ( 'copy:prod' , function ( ) {
130+ return gulp . src ( [ BUILD + '**/*.+(html|woff)' , '!' + BUILD + '/shared/**/*.html' , '!' + BUILD + '**/example.html' ] )
131+ . pipe ( changed ( DIST ) )
132+ . pipe ( debug ( ) )
133+ . pipe ( gulp . dest ( DIST ) ) ;
134+ } ) ;
135+
136+ // gulp.task('minify:prod', function() {
137+ // return gulp.src(BUILD+'strand.html')
138+ // .pipe(debug())
139+ // .pipe(htmlmin({
140+ // quotes: true,
141+ // empty: true,
142+ // spare: true
143+ // }))
144+ // .pipe(inlinemin())
145+ // .pipe(gulp.dest(DIST))
146+ // });
147+
124148/** DOCS **/
125149
126150gulp . task ( 'docs' , function ( ) {
@@ -145,3 +169,28 @@ gulp.task('watch', function () {
145169} ) ;
146170
147171/** DEPLOY **/
172+
173+ gulp . task ( 'build:prod' , [ 'clean' , 'copy' , 'sass' , 'font' , 'vulcanize:prod' ] ) ;
174+
175+ gulp . task ( 'bump:major' , function ( ) {
176+ return gulp . src ( [ 'package.json' , 'bower.json' ] )
177+ . pipe ( bump ( { type : 'major' } ) )
178+ . pipe ( gulp . dest ( './' ) ) ;
179+ } ) ;
180+ gulp . task ( 'bump:minor' , function ( ) {
181+ return gulp . src ( [ 'package.json' , 'bower.json' ] )
182+ . pipe ( bump ( { type : 'minor' } ) )
183+ . pipe ( gulp . dest ( './' ) ) ;
184+ } ) ;
185+ gulp . task ( 'bump:patch' , function ( ) {
186+ return gulp . src ( [ 'package.json' , 'bower.json' ] )
187+ . pipe ( bump ( { type : 'patch' } ) )
188+ . pipe ( gulp . dest ( './' ) ) ;
189+ } ) ;
190+
191+ gulp . task ( 'stage-release' , function ( ) {
192+ var pkg = JSON . parse ( fs . readFileSync ( 'package.json' , 'utf8' ) ) ;
193+ return gulp . src ( [ DIST , 'package.json' , 'bower.json' , 'CHANGELOG.md' ] )
194+ . pipe ( git . add ( ) )
195+ . pipe ( git . commit ( 'Release v' + pkg . version ) ) ;
196+ } ) ;
0 commit comments