Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: web/apps/gulp-common.js

Issue 2969643003: [web] Update packages, use TS 2.4 (Closed)
Patch Set: [web] Update packages, use TS 2.4 Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | web/inc/logdog-stream-view/model.ts » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 Copyright 2016 The LUCI Authors. All rights reserved. 2 Copyright 2016 The LUCI Authors. All rights reserved.
3 Use of this source code is governed under the Apache License, Version 2.0 3 Use of this source code is governed under the Apache License, Version 2.0
4 that can be found in the LICENSE file. 4 that can be found in the LICENSE file.
5 5
6 This document has been largely derived from the Polymer Starter Kit: 6 This document has been largely derived from the Polymer Starter Kit:
7 https://github.com/PolymerElements/polymer-starter-kit 7 https://github.com/PolymerElements/polymer-starter-kit
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
11 11
12 var path = require('path'); 12 var path = require('path');
13 var argv = require('yargs').argv; 13 var argv = require('yargs').argv;
14 14
15 var exports = module.exports = {} 15 var exports = module.exports = {}
16 exports.base = path.join(__dirname, '..'); 16 exports.base = path.join(__dirname, '..');
17 exports.out = (argv.out || exports.base); 17 exports.out = (argv.out || exports.base);
18 exports.plugins = require('gulp-load-plugins')({ 18 exports.plugins = require('gulp-load-plugins')({
19 config: path.join(exports.base, 'package.json'), 19 config: path.join(exports.base, 'package.json'),
20 }); 20 });
21 21
22 // Include Gulp & tools we'll use 22 // Include Gulp & tools we'll use
23 var $ = exports.plugins; 23 var $ = exports.plugins;
24 var browserSync = require('browser-sync'); 24 var browserSync = require('browser-sync');
25 var cleanCSS = require('gulp-clean-css');
25 var debug = require('gulp-debug'); 26 var debug = require('gulp-debug');
26 var del = require('del'); 27 var del = require('del');
27 var format = require('gulp-clang-format'); 28 var format = require('gulp-clang-format');
28 var fs = require('fs'); 29 var fs = require('fs');
29 var glob = require('glob-all'); 30 var glob = require('glob-all');
30 var gulpIf = require('gulp-if'); 31 var gulpIf = require('gulp-if');
32 var htmlmin = require('gulp-htmlmin');
31 var historyApiFallback = require('connect-history-api-fallback'); 33 var historyApiFallback = require('connect-history-api-fallback');
32 var hyd = require('hydrolysis'); 34 var hyd = require('hydrolysis');
33 var merge = require('merge-stream'); 35 var merge = require('merge-stream');
34 var reload = browserSync.reload; 36 var reload = browserSync.reload;
35 var runSequence = require('run-sequence'); 37 var runSequence = require('run-sequence');
36 var ts = require('gulp-typescript'); 38 var ts = require('gulp-typescript');
37 var sourcemaps = require('gulp-sourcemaps'); 39 var sourcemaps = require('gulp-sourcemaps');
38 var tslint = require('gulp-tslint'); 40 var tslint = require('gulp-tslint');
39 41
40 42
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 return path.join.apply(null, parts); 136 return path.join.apply(null, parts);
135 }; 137 };
136 }; 138 };
137 139
138 var styleTask = function(stylesPath, srcs) { 140 var styleTask = function(stylesPath, srcs) {
139 return gulp.src(srcs.map(function(src) { 141 return gulp.src(srcs.map(function(src) {
140 return path.join(stylesPath, src); 142 return path.join(stylesPath, src);
141 })) 143 }))
142 .pipe($.autoprefixer(AUTOPREFIXER_BROWSERS)) 144 .pipe($.autoprefixer(AUTOPREFIXER_BROWSERS))
143 .pipe(gulp.dest('.tmp/' + stylesPath)) 145 .pipe(gulp.dest('.tmp/' + stylesPath))
144 .pipe($.minifyCss()) 146 .pipe(cleanCSS())
145 .pipe(gulp.dest(layout.dist(stylesPath))) 147 .pipe(gulp.dest(layout.dist(stylesPath)))
146 .pipe($.size({title: stylesPath})); 148 .pipe($.size({title: stylesPath}));
147 }; 149 };
148 150
149 var imageOptimizeTask = function(src, dest) { 151 var imageOptimizeTask = function(src, dest) {
150 return gulp.src(src) 152 return gulp.src(src)
151 .pipe($.imagemin({ 153 .pipe($.imagemin({
152 progressive: true, 154 progressive: true,
153 interlaced: true 155 interlaced: true
154 })) 156 }))
155 .pipe(gulp.dest(dest)) 157 .pipe(gulp.dest(dest))
156 .pipe($.size({title: 'images'})); 158 .pipe($.size({title: 'images'}));
157 }; 159 };
158 160
159 var optimizeHtmlTask = function(src, dest) { 161 var optimizeHtmlTask = function(src, dest) {
160 var assets = $.useref.assets({ 162 var assets = $.useref.assets({
161 searchPath: ['.tmp', config.dir] 163 searchPath: ['.tmp', config.dir]
162 }); 164 });
163 165
164 return gulp.src(src) 166 return gulp.src(src)
165 .pipe(assets) 167 .pipe(assets)
166 // Concatenate and minify JavaScript 168 // Concatenate and minify JavaScript
167 .pipe($.if('*.js', $.uglify({ 169 .pipe($.if('*.js', $.uglify({
168 preserveComments: 'some' 170 preserveComments: 'some'
169 }))) 171 })))
170 // Concatenate and minify styles 172 // Concatenate and minify styles
171 // In case you are still using useref build blocks 173 // In case you are still using useref build blocks
172 .pipe($.if('*.css', $.minifyCss())) 174 .pipe($.if('*.css', cleanCSS()))
173 .pipe(assets.restore()) 175 .pipe(assets.restore())
174 .pipe($.useref()) 176 .pipe($.useref())
175 // Minify any HTML 177 // Minify any HTML
176 .pipe($.if('*.html', $.minifyHtml({ 178 .pipe($.if('*.html', htmlmin({
177 quotes: true, 179 remoteAttributeQuotes: false,
178 empty: true, 180 remoteEmptyAttributes: false,
179 spare: true 181 remoteRedundantAttributes: false,
180 }))) 182 })))
181 // Output files 183 // Output files
182 .pipe(gulp.dest(dest)) 184 .pipe(gulp.dest(dest))
183 .pipe($.size({ 185 .pipe($.size({
184 title: 'html' 186 title: 'html'
185 })); 187 }));
186 }; 188 };
187 189
188 // Transpiles "inc/*/*.ts" and deposits the result alongside their source 190 // Transpiles "inc/*/*.ts" and deposits the result alongside their source
189 // "ts" files. 191 // "ts" files.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 }); 361 });
360 362
361 // Install common targets. 363 // Install common targets.
362 exports.setup_common(gulp); 364 exports.setup_common(gulp);
363 }; 365 };
364 366
365 // Load custom tasks from the `tasks` directory 367 // Load custom tasks from the `tasks` directory
366 try { 368 try {
367 require('require-dir')('tasks'); 369 require('require-dir')('tasks');
368 } catch (err) {} 370 } catch (err) {}
OLDNEW
« no previous file with comments | « no previous file | web/inc/logdog-stream-view/model.ts » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698