Remove gulpfile.js and package.json
gulp isn't being used for deployment and the deps pulled in by package are no longer needed (and can cause issues with version skew and WCT). Change-Id: If2a0f9bdd276a7144313bfdeb2ffe876cefbd9ad
This commit is contained in:
parent
d8b0f26755
commit
275e59044a
@ -1,177 +0,0 @@
|
||||
// Copyright (C) 2015 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
'use strict';
|
||||
|
||||
// Include Gulp & tools we'll use
|
||||
var gulp = require('gulp');
|
||||
var $ = require('gulp-load-plugins')();
|
||||
var del = require('del');
|
||||
var runSequence = require('run-sequence');
|
||||
var merge = require('merge-stream');
|
||||
var path = require('path');
|
||||
var historyApiFallback = require('connect-history-api-fallback');
|
||||
|
||||
var AUTOPREFIXER_BROWSERS = [
|
||||
'ie >= 10',
|
||||
'ie_mob >= 10',
|
||||
'ff >= 30',
|
||||
'chrome >= 34',
|
||||
'safari >= 7',
|
||||
'opera >= 23',
|
||||
'ios >= 7',
|
||||
'android >= 4.4',
|
||||
'bb >= 10'
|
||||
];
|
||||
|
||||
var styleTask = function (stylesPath, srcs) {
|
||||
return gulp.src(srcs.map(function(src) {
|
||||
return path.join('app', stylesPath, src);
|
||||
}))
|
||||
.pipe($.changed(stylesPath, {extension: '.css'}))
|
||||
.pipe($.autoprefixer(AUTOPREFIXER_BROWSERS))
|
||||
.pipe(gulp.dest('.tmp/' + stylesPath))
|
||||
.pipe($.cssmin())
|
||||
.pipe(gulp.dest('dist/' + stylesPath))
|
||||
.pipe($.size({title: stylesPath}));
|
||||
};
|
||||
|
||||
var imageOptimizeTask = function (src, dest) {
|
||||
return gulp.src(src)
|
||||
.pipe($.cache($.imagemin({
|
||||
progressive: true,
|
||||
interlaced: true
|
||||
})))
|
||||
.pipe(gulp.dest(dest))
|
||||
.pipe($.size({title: 'images'}));
|
||||
};
|
||||
|
||||
var optimizeHtmlTask = function (src, dest) {
|
||||
var assets = $.useref.assets({searchPath: ['.tmp', 'app', 'dist']});
|
||||
|
||||
return gulp.src(src)
|
||||
// Replace path for vulcanized assets
|
||||
.pipe($.if('*.html', $.replace('elements/gr-app.html', 'elements/gr-app.vulcanized.html')))
|
||||
.pipe(assets)
|
||||
// Concatenate and minify JavaScript
|
||||
.pipe($.if('*.js', $.uglify({preserveComments: 'some'})))
|
||||
// Concatenate and minify styles
|
||||
// In case you are still using useref build blocks
|
||||
.pipe($.if('*.css', $.cssmin()))
|
||||
.pipe(assets.restore())
|
||||
.pipe($.useref())
|
||||
// Minify any HTML
|
||||
.pipe($.if('*.html', $.minifyHtml({
|
||||
quotes: true,
|
||||
empty: true,
|
||||
spare: true
|
||||
})))
|
||||
// Output files
|
||||
.pipe(gulp.dest(dest))
|
||||
.pipe($.size({title: 'html'}));
|
||||
};
|
||||
|
||||
// Compile and automatically prefix stylesheets
|
||||
gulp.task('styles', function () {
|
||||
return styleTask('styles', ['**/*.css']);
|
||||
});
|
||||
|
||||
gulp.task('elements', function () {
|
||||
return styleTask('elements', ['**/*.css']);
|
||||
});
|
||||
|
||||
// Optimize images
|
||||
gulp.task('images', function () {
|
||||
return imageOptimizeTask('app/images/**/*', 'dist/images');
|
||||
});
|
||||
|
||||
// Copy all files at the root level (app)
|
||||
gulp.task('copy', function () {
|
||||
var app = gulp.src([
|
||||
'app/*',
|
||||
'!app/test'
|
||||
], {
|
||||
dot: true
|
||||
}).pipe(gulp.dest('dist'));
|
||||
|
||||
var bower = gulp.src([
|
||||
'bower_components/**/*'
|
||||
]).pipe(gulp.dest('dist/bower_components'));
|
||||
|
||||
var elements = gulp.src(['app/elements/**/*.html',
|
||||
'app/elements/**/*.css',
|
||||
'app/elements/**/*.js'])
|
||||
.pipe(gulp.dest('dist/elements'));
|
||||
|
||||
var scripts = gulp.src(['app/scripts/**/*.js'])
|
||||
.pipe(gulp.dest('dist/scripts'));
|
||||
|
||||
var vulcanized = gulp.src(['app/elements/gr-app.html'])
|
||||
.pipe($.rename('gr-app.vulcanized.html'))
|
||||
.pipe(gulp.dest('dist/elements'));
|
||||
|
||||
return merge(app, bower, elements, scripts, vulcanized)
|
||||
.pipe($.size({title: 'copy'}));
|
||||
});
|
||||
|
||||
// Copy web fonts to dist
|
||||
gulp.task('fonts', function () {
|
||||
return gulp.src(['app/fonts/**'])
|
||||
.pipe(gulp.dest('dist/fonts'))
|
||||
.pipe($.size({title: 'fonts'}));
|
||||
});
|
||||
|
||||
// Scan your HTML for assets & optimize them
|
||||
gulp.task('html', function () {
|
||||
return optimizeHtmlTask(
|
||||
['app/**/*.html', '!app/{elements,test}/**/*.html'],
|
||||
'dist');
|
||||
});
|
||||
|
||||
// Vulcanize granular configuration.
|
||||
gulp.task('vulcanize', function () {
|
||||
var DEST_DIR = 'dist/elements';
|
||||
return gulp.src('dist/elements/gr-app.vulcanized.html')
|
||||
.pipe($.vulcanize({
|
||||
stripComments: true,
|
||||
inlineCss: true,
|
||||
inlineScripts: true
|
||||
}))
|
||||
.pipe(gulp.dest(DEST_DIR))
|
||||
.pipe($.size({title: 'vulcanize'}));
|
||||
});
|
||||
|
||||
// Clean output directory
|
||||
gulp.task('clean', function (cb) {
|
||||
del(['.tmp', 'dist'], cb);
|
||||
});
|
||||
|
||||
|
||||
// Build production files, the default task
|
||||
gulp.task('default', ['clean'], function (cb) {
|
||||
// Uncomment 'cache-config' if you are going to use service workers.
|
||||
runSequence(
|
||||
['copy', 'styles'],
|
||||
'elements',
|
||||
['images', 'fonts', 'html'],
|
||||
'vulcanize', // 'cache-config',
|
||||
cb);
|
||||
});
|
||||
|
||||
// Load tasks for web-component-tester
|
||||
// Adds tasks for `gulp test:local` and `gulp test:remote`
|
||||
require('web-component-tester').gulp.init(gulp);
|
||||
|
||||
// Load custom tasks from the `tasks` directory
|
||||
try { require('require-dir')('tasks'); } catch (err) {}
|
@ -1,39 +0,0 @@
|
||||
{
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"browser-sync": "^2.7.7",
|
||||
"connect-history-api-fallback": "^1.1.0",
|
||||
"del": "^1.1.1",
|
||||
"gulp": "^3.8.5",
|
||||
"gulp-autoprefixer": "^2.1.0",
|
||||
"gulp-cache": "^0.2.8",
|
||||
"gulp-changed": "^1.0.0",
|
||||
"gulp-cssmin": "^0.1.7",
|
||||
"gulp-flatten": "0.0.4",
|
||||
"gulp-if": "^1.2.1",
|
||||
"gulp-imagemin": "^2.2.1",
|
||||
"gulp-jshint": "^1.6.3",
|
||||
"gulp-load-plugins": "^0.10.0",
|
||||
"gulp-minify-html": "^1.0.2",
|
||||
"gulp-rename": "^1.2.0",
|
||||
"gulp-replace": "^0.5.3",
|
||||
"gulp-size": "^1.0.0",
|
||||
"gulp-uglify": "^1.2.0",
|
||||
"gulp-useref": "^1.1.2",
|
||||
"gulp-vulcanize": "^6.0.0",
|
||||
"jshint-stylish": "^2.0.0",
|
||||
"merge-stream": "^0.1.7",
|
||||
"opn": "^1.0.0",
|
||||
"require-dir": "^0.3.0",
|
||||
"run-sequence": "^1.0.2",
|
||||
"vulcanize": ">= 1.4.2",
|
||||
"web-component-tester": "^3.1.3"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "gulp test:local",
|
||||
"start": "gulp serve"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user