-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile_old.js
95 lines (85 loc) · 2.62 KB
/
gulpfile_old.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
var gulp = require('gulp'),
less = require('gulp-less'),
concat = require('gulp-concat'),
webpack = require('webpack'),
runSequence = require('run-sequence'),
webpackConfig = require("./webpack.config.js"),
gutil = require("gulp-util"),
template = require('gulp-template-compile'),
ghPages = require('gulp-gh-pages');
gulp.task('copy-index-html', function () {
gulp.src('./src/index.html')
.pipe(gulp.dest('./site'));
});
gulp.task("webpack:build", function (callback) {
// modify some webpack config options
var myConfig = Object.create(webpackConfig);
myConfig.plugins = myConfig.plugins.concat(
new webpack.DefinePlugin({
"process.env": {
// This has effect on the react lib size
"NODE_ENV": JSON.stringify("production")
}
})
//new webpack.optimize.DedupePlugin(),
//new webpack.optimize.UglifyJsPlugin()
);
// run webpack
webpack(myConfig, function (err, stats) {
if (err) throw new gutil.PluginError("webpack:build", err);
gutil.log("[webpack:build]", stats.toString({
colors: true
}));
callback();
});
});
gulp.task('build', function (callback) {
runSequence('webpack:build',
'copy-index-html',
callback);
});
gulp.task('deploy', function() {
return gulp.src('./site/**/*')
.pipe(ghPages());
});
//gulp.task('move-fonts', function () {
// gulp.src('./*.{ttf,woff,woff2,eof,eot,svg}')
// .pipe(gulp.dest('./public'))
// .on('end', function () {
// del('./*.{ttf,woff,woff2,eof,eot,svg}');
// });
//});
//gulp.task('styles', function () {
// return gulp.src('../less/*.less')
// .pipe(less())
// .pipe(concat('app.css'))
// .pipe(gulp.dest('../css/'));
//});
//gulp.task('tt-styles', function () {
// return gulp.src('../../base/*.less')
// .pipe(less())
// .pipe(concat('tooltip.css'))
// .pipe(gulp.dest('../../base/'));
//});
//
gulp.task('templates', function () {
gulp.src('./src/js/templates/*.html')
.pipe(template())
.pipe(concat('templates.js'))
.pipe(gulp.dest('./src/js'));
});
//
//
//
//gulp.task('full', ['webpack', 'copy-ttf-files']);
//
//// Watch Files For Changes
//gulp.task('watch', function () {
// gulp.watch('../js/templates/*.html', ['templates']);
// gulp.watch('../less/*.less', ['styles']);
// gulp.watch('../../base/*.less', ['tt-styles']);
//});
//
//// Default Task
//gulp.task('default', ['styles', 'templates']);
//gulp.task('watch-default', ['styles', 'templates', 'watch']);