-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathgulpfile.js
104 lines (94 loc) · 3.15 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
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
96
97
98
99
100
101
102
103
104
var gulp = require('gulp'),
sass = require('node-sass');
gulpLoadPlugins = require('gulp-load-plugins'),
plugins = gulpLoadPlugins();
gulp.task('build-component', function() {
// place code for your default task here
gulp.src('components/todo-list/*.html')
.pipe(plugins.watch('components/**/*.html'))
.pipe(plugins.nova({
combo: {
baseUrl: '.'
},
precss: function(sourceCss) {
var result = sass.renderSync({
data: sourceCss
});
return result.css;
},
umd: null
}))
.pipe(plugins.rename(function(path) {
console.log('building component', path);
path.extname = '.js';
}))
.pipe(plugins.babel())
.pipe(gulp.dest('components'));
});
gulp.task('build-nova-components', function() {
// place code for your default task here
gulp.src('src_babel/components/**/*.html')
.pipe(plugins.watch('src_babel/components/**/*.html'))
.pipe(plugins.nova({
umd: null,
postcss: [require('autoprefixer')]
}))
.pipe(plugins.rename(function(path) {
console.log('building component', path);
path.extname = '.js';
}))
.pipe(gulp.dest('src_babel/components'));
});
gulp.task('build-nova', function() {
gulp.src('src_babel/**/*.js')
.pipe(plugins.watch('src_babel/**/*.js'))
.pipe(plugins.babel())
.pipe(plugins.rename(function(path) {
console.log('building nova', path);
}))
.pipe(gulp.dest('src'))
.pipe(plugins.rename(function(path) {
gulp.start('release');
}));
});
gulp.task('release', function() {
// 打包nova
gulp.start('concat-nova');
// 打包nova_dev
gulp.src('src/nova_dev.js')
.pipe(gulp.dest('./build'));
// 打包nova_polyfills
gulp.src([
'lib/document-register-element.js',
'lib/es6-map-shim.js'
])
.pipe(plugins.concat('nova_polyfills.js'))
.pipe(gulp.dest('./build'));
});
gulp.task('concat-nova', function() {
gulp.src([
'src/nova_bootstrap.js',
'src/lib/css_parse.js',
'src/lib/case_map.js',
'src/lib/utils.js',
'src/lib/initial.js',
'src/nova_static_lifecycle.js',
'src/nova_static_dev.js',
'src/style.js',
'src/event_behavior.js',
'src/aspect_behavior.js',
'src/properties_behavior.js',
'src/template/expression_parser.js',
'src/template/expression_evaluator.js',
'src/template/template_behavior.js',
'src/style_behavior.js',
'src/base.js',
'src/components/template-repeat/main.js',
'src/components/template-if/main.js',
'src/components/template-repeat-item/main.js'
])
.pipe(plugins.concat('nova.js'))
.pipe(plugins.removeUseStrict())
.pipe(gulp.dest('./build'));
});
gulp.task('default', ['build-nova', 'build-nova-components']);