-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
57 lines (53 loc) · 1.58 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
'use strict';
var gulp = require( 'gulp' );
var rename = require('gulp-rename');
var header = require('gulp-header');
var uglify = require('gulp-uglify');
var minifyCss = require('gulp-minify-css');
var util= require( 'gulp-util' );
var concat = require('gulp-concat');
var GulpSSH = require('gulp-ssh');
var CSS="./css/";
var DIST="./dist/";
var JSPuth="./js/";
var DISTJS=DIST+'js/';
var DISTCSS=DIST+'css/';
var Version='1.0.0'; //版本号
var Author='Junr'; //作者
var buildDate = util.date(Date.now(), 'isoDate')+" "+util.date(Date.now(), 'isoTime'); //更新时间
var banner = '/*\n * Junr.me '+Version+'\n * '+buildDate+'\n * Copyright (c) 2016 Licensed MIT <> \n */ \n';
//测试环境发布参数
var config = {
host: '192.168.10.107',
port: 22,
username: 'kbang',
password: 'kbang@kbang'
}
var gulpSSH = new GulpSSH({
ignoreErrors: false,
sshConfig: config
})
gulp.task('ftp', function () {
return gulp
.src(['./dist/*/*'])
.pipe(gulpSSH.dest('/home/kbang/'))
})
gulp.task('JS', function() {
return gulp.src(JSPuth+'*.js')
//.pipe(ngmin({dynamic: false}))
//.pipe(stripDebug())
.pipe(concat('base.min.'+Version+'.js'))
.pipe(uglify({outSourceMap: false}))
.pipe(header(banner))
.pipe(gulp.dest(DISTJS));
});
gulp.task('CSS', function() {
gulp.src(CSS+'*.css')
.pipe(concat('base.min.'+Version+'.css'))
.pipe(minifyCss({
advanced: true
}))
.pipe(header(banner))
.pipe(gulp.dest(DISTCSS));
});
gulp.task('default', ['JS','CSS']);