11/**
22 *
3- * Quickstart gulpfile.js, This has changed from Web Starter Kit
3+ * Quickstart gulpfile.js, This has changed come from Web Starter Kit
44 *
55 * Licensed under Apache License, Copyright 2014 Google Inc.
66 * See the LICENSE for more details of licence
@@ -13,21 +13,8 @@ var $ = require('gulp-load-plugins')();
1313var del = require ( 'del' ) ;
1414var runSequence = require ( 'run-sequence' ) ;
1515var browserSync = require ( 'browser-sync' ) ;
16- var pagespeed = require ( 'psi' ) ;
1716var reload = browserSync . reload ;
1817
19- var AUTOPREFIXER_BROWSERS = [
20- 'ie >= 10' ,
21- 'ie_mob >= 10' ,
22- 'ff >= 30' ,
23- 'chrome >= 34' ,
24- 'safari >= 7' ,
25- 'opera >= 23' ,
26- 'ios >= 7' ,
27- 'android >= 4.4' ,
28- 'bb >= 10'
29- ] ;
30-
3118// Lint JavaScript
3219gulp . task ( 'jshint' , function ( ) {
3320 return gulp . src ( 'app/scripts/**/*.js' )
@@ -59,76 +46,52 @@ gulp.task('copy', function () {
5946 . pipe ( $ . size ( { title : 'copy' } ) ) ;
6047} ) ;
6148
62-
63- // Compile and Automatically Prefix Stylesheets
64- gulp . task ( 'styles' , function ( ) {
65- // For best performance, don't add Sass partials to `gulp.src`
66- return gulp . src ( [
67- 'app/styles/**/*.css' ,
68- ] ) . on ( 'error' , console . error . bind ( console ) )
69- . pipe ( $ . autoprefixer ( { browsers : AUTOPREFIXER_BROWSERS } ) )
70- . pipe ( gulp . dest ( '.tmp/styles' ) )
71- // Concatenate And Minify Styles
72- . pipe ( $ . if ( '*.css' , $ . csso ( ) ) )
73- . pipe ( gulp . dest ( 'dist/styles' ) )
74- . pipe ( $ . size ( { title : 'styles' } ) ) ;
75- } ) ;
76-
7749// Scan Your HTML For Assets & Optimize Them
7850gulp . task ( 'html' , function ( ) {
79- var assets = $ . useref . assets ( { searchPath : '{.tmp, app}' } ) ;
51+ var assets = $ . useref . assets ( { searchPath : [ ' app' ] } ) ;
8052
81- return gulp . src ( 'app/**/*.html' )
53+ return gulp . src ( 'app/**/*.html' ) . on ( 'error' , console . error . bind ( console ) )
8254 . pipe ( assets )
83- // Concatenate And Minify JavaScript
8455 . pipe ( $ . if ( '*.js' , $ . uglify ( { preserveComments : 'some' } ) ) )
85- // Remove Any Unused CSS
86- // Note: If not using the Style Guide, you can delete it from
87- // the next line to only include styles your project uses.
88- . pipe ( $ . if ( '*.css' , $ . uncss ( {
89- html : [
90- 'app/index.html' ,
91- ] ,
92- // CSS Selectors for UnCSS to ignore
93- ignore : [ ]
94- } ) ) )
95- // Concatenate And Minify Styles
96- // In case you are still using useref build blocks
9756 . pipe ( $ . if ( '*.css' , $ . csso ( ) ) )
9857 . pipe ( assets . restore ( ) )
9958 . pipe ( $ . useref ( ) )
100- // Update Production Style Guide Paths
101- . pipe ( $ . replace ( 'components/components.css' , 'components/main.min.css' ) )
102- // Minify Any HTML
10359 . pipe ( $ . if ( '*.html' , $ . minifyHtml ( ) ) )
104- // Output Files
10560 . pipe ( gulp . dest ( 'dist' ) )
10661 . pipe ( $ . size ( { title : 'html' } ) ) ;
10762} ) ;
10863
64+ // Copy the files associated with components
65+ gulp . task ( 'assets' , function ( ) {
66+ return gulp . src ( [
67+ 'bower_components/iCheck/skins/**/*' ,
68+ '!bower_components/iCheck/skins/all.css' ,
69+ 'bower_components/chosen/[email protected] ' , 70+ 'bower_components/chosen/chosen-sprite.png' ,
71+ ] , {
72+ dot : true
73+ } ) . pipe ( gulp . dest ( 'dist/styles' ) )
74+ . pipe ( $ . size ( { title : 'copy' } ) ) ;
75+ } ) ;
76+
10977// Clean Output Directory
110- gulp . task ( 'clean' , del . bind ( null , [ '.tmp' , ' dist'] ) ) ;
78+ gulp . task ( 'clean' , del . bind ( null , [ 'dist' ] ) ) ;
11179
11280// Watch Files For Changes & Reload
113- gulp . task ( 'serve' , [ 'styles' ] , function ( ) {
81+ gulp . task ( 'serve' , function ( ) {
11482 browserSync ( {
11583 notify : false ,
116- // Customize the BrowserSync console logging prefix
11784 logPrefix : 'QS' ,
118- // Run as an https by uncommenting 'https: true'
119- // Note: this uses an unsigned certificate which on first access
120- // will present a certificate warning in the browser.
121- // https: true,
12285 server : {
123- baseDir : [ '.tmp' , ' app'] ,
86+ baseDir : ' app',
12487 routes : {
12588 "/bower_components" : "./bower_components"
12689 }
12790 }
12891 } ) ;
12992
13093 gulp . watch ( [ 'app/**/*.html' ] , reload ) ;
131- gulp . watch ( [ 'app/styles/**/*.css' ] , [ 'styles' , reload ] ) ;
94+ gulp . watch ( [ 'app/styles/**/*.css' ] , [ reload ] ) ;
13295 gulp . watch ( [ 'app/scripts/**/*.js' ] , [ 'jshint' ] ) ;
13396 gulp . watch ( [ 'app/images/**/*' ] , reload ) ;
13497} ) ;
@@ -138,15 +101,11 @@ gulp.task('serve:dist', ['default'], function () {
138101 browserSync ( {
139102 notify : false ,
140103 logPrefix : 'QS' ,
141- // Run as an https by uncommenting 'https: true'
142- // Note: this uses an unsigned certificate which on first access
143- // will present a certificate warning in the browser.
144- // https: true,
145104 server : 'dist'
146105 } ) ;
147106} ) ;
148107
149108// Build Production Files, the Default Task
150109gulp . task ( 'default' , [ 'clean' ] , function ( cb ) {
151- runSequence ( 'styles' , [ 'jshint' , 'html' , 'images' , 'copy' ] , cb ) ;
110+ runSequence ( [ 'jshint' , 'html' , 'images' , 'copy' , 'assets '] , cb ) ;
152111} ) ;
0 commit comments