mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
chore(build): windows error improvements, better cssmin
This commit is contained in:
6
config/version.template.json
Normal file
6
config/version.template.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": "<%= pkg.version %>",
|
||||
"codename": "<%= pkg.codename %>",
|
||||
"date": "<%= date %>",
|
||||
"time": "<%= time %>"
|
||||
}
|
||||
57
gulpfile.js
57
gulpfile.js
@@ -4,7 +4,6 @@ var connect = require('connect');
|
||||
var dgeni = require('dgeni');
|
||||
var http = require('http');
|
||||
var cp = require('child_process');
|
||||
var fs = require('fs');
|
||||
var gulp = require('gulp');
|
||||
var pkg = require('./package.json');
|
||||
var through = require('through');
|
||||
@@ -13,10 +12,10 @@ var argv = require('minimist')(process.argv.slice(2));
|
||||
|
||||
var bump = require('gulp-bump');
|
||||
var concat = require('gulp-concat');
|
||||
var cssmin = require('gulp-cssmin');
|
||||
var gulpif = require('gulp-if');
|
||||
var header = require('gulp-header');
|
||||
var jshint = require('gulp-jshint');
|
||||
var minifyCss = require('gulp-minify-css');
|
||||
var rename = require('gulp-rename');
|
||||
var sass = require('gulp-sass');
|
||||
var stripDebug = require('gulp-strip-debug');
|
||||
@@ -28,7 +27,7 @@ var banner = _.template(buildConfig.banner, { pkg: pkg });
|
||||
|
||||
var IS_RELEASE_BUILD = !!argv.release;
|
||||
if (IS_RELEASE_BUILD) {
|
||||
gutil.log(gutil.colors.red('--release=true:'),
|
||||
gutil.log(gutil.colors.red('--release:'),
|
||||
'Building release version (minified, debugs stripped)...'
|
||||
);
|
||||
}
|
||||
@@ -40,7 +39,9 @@ gulp.task('docs', function() {
|
||||
dgeni('docs/docs.config.js').generateDocs();
|
||||
});
|
||||
|
||||
var IS_WATCH = false;
|
||||
gulp.task('watch', function() {
|
||||
IS_WATCH = true;
|
||||
gulp.watch('js/**/*.js', ['bundle', 'docs']);
|
||||
gulp.watch('docs/**/*', ['docs']);
|
||||
gulp.watch('scss/**/*.scss', ['sass']);
|
||||
@@ -54,6 +55,7 @@ gulp.task('bundle', [
|
||||
'scripts',
|
||||
'scripts-ng',
|
||||
'vendor',
|
||||
'version',
|
||||
], function() {
|
||||
IS_RELEASE_BUILD && gulp.src(buildConfig.ionicBundleFiles.map(function(src) {
|
||||
return src.replace(/.js$/, '.min.js');
|
||||
@@ -62,16 +64,6 @@ gulp.task('bundle', [
|
||||
.pipe(concat('ionic.bundle.min.js'))
|
||||
.pipe(gulp.dest(buildConfig.distJs));
|
||||
|
||||
var d = new Date();
|
||||
fs.writeFileSync('dist/version.json', JSON.stringify({
|
||||
version: pkg.version,
|
||||
codename: pkg.codename,
|
||||
date: d.toISOString().substring(0,10),
|
||||
time: pad(d.getUTCHours()) +
|
||||
':' + pad(d.getUTCMinutes()) +
|
||||
':' + pad(d.getUTCSeconds())
|
||||
}, null, 2));
|
||||
|
||||
return gulp.src(buildConfig.ionicBundleFiles)
|
||||
.pipe(header(buildConfig.bundleBanner))
|
||||
.pipe(concat('ionic.bundle.js'))
|
||||
@@ -125,18 +117,47 @@ gulp.task('scripts-ng', function() {
|
||||
.pipe(gulp.dest(buildConfig.distJs));
|
||||
});
|
||||
|
||||
gulp.task('sass', function() {
|
||||
return gulp.src('scss/ionic.scss')
|
||||
gulp.task('sass', function(done) {
|
||||
gulp.src('scss/ionic.scss')
|
||||
.pipe(header(banner))
|
||||
.pipe(sass())
|
||||
.pipe(sass({
|
||||
onError: function(err) {
|
||||
//If we're watching, don't exit on error
|
||||
if (IS_WATCH) {
|
||||
console.log(gutil.colors.red(err));
|
||||
} else {
|
||||
done(err);
|
||||
}
|
||||
}
|
||||
}))
|
||||
.pipe(concat('ionic.css'))
|
||||
.pipe(gulp.dest(buildConfig.distCss))
|
||||
.pipe(gulpif(IS_RELEASE_BUILD, cssmin()))
|
||||
.pipe(gulpif(IS_RELEASE_BUILD, minifyCss({
|
||||
keepSpecialComments: 0
|
||||
})))
|
||||
.pipe(header(banner))
|
||||
.pipe(rename({ extname: '.min.css' }))
|
||||
.pipe(gulp.dest(buildConfig.distCss));
|
||||
.pipe(gulp.dest(buildConfig.distCss))
|
||||
.on('end', done);
|
||||
});
|
||||
|
||||
gulp.task('version', function() {
|
||||
var d = new Date();
|
||||
var date = d.toISOString().substring(0,10);
|
||||
var time = pad(d.getUTCHours()) +
|
||||
':' + pad(d.getUTCMinutes()) +
|
||||
':' + pad(d.getUTCSeconds());
|
||||
return gulp.src('config/version.template.json')
|
||||
.pipe(template({
|
||||
pkg: pkg,
|
||||
date: date,
|
||||
time: time
|
||||
}))
|
||||
.pipe(rename('version.json'))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
|
||||
gulp.task('sauce-connect', sauceConnect);
|
||||
|
||||
gulp.task('cloudtest', ['protractor-sauce'], function(cb) {
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
"jshint-stylish": "^0.1.5",
|
||||
"gulp-template": "^0.1.1",
|
||||
"gulp-concat": "^2.1.7",
|
||||
"gulp-cssmin": "^0.1.3",
|
||||
"gulp-jshint": "^1.5.0",
|
||||
"gulp-strip-debug": "^0.2.0",
|
||||
"gulp-sass": "^0.7.1",
|
||||
@@ -36,7 +35,8 @@
|
||||
"canonical-path": "0.0.2",
|
||||
"lodash": "^2.4.1",
|
||||
"winston": "^0.7.2",
|
||||
"minimist": "0.0.8"
|
||||
"minimist": "0.0.8",
|
||||
"gulp-minify-css": "^0.3.0"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user