forked from foolishchow/element-tree-grid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
82 lines (75 loc) · 2.19 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
'use strict';
const path = require('path'),
gulp = require('gulp'),
rename = require('gulp-rename'),
rollup = require('gulp-rollup'),
vue = require('./bin/vue/index'),
css = require('./bin/post-css'),
babel = require('rollup-plugin-babel'),
nodeResolve = require('rollup-plugin-node-resolve'),
// commonjs = require('rollup-plugin-commonjs'),
// replace = require('rollup-plugin-replace'),
salad = require('postcss-salad'),
uglify = require('gulp-uglify');
const rollupConfig = {
entry: './src/index.js',
globals: { 'vue': 'Vue' },
moduleName: 'ELEMENT_TREE_COLUMN',
plugins: [
vue({
compileTemplate: true,
styleToImports: true
}),
nodeResolve({
browser: true,
// jsnext: true,
main: true,
skip: ['vue']
}),
babel({ runtimeHelpers: false }),
],
format: 'umd'
}
const rollupConfigCommon = {
entry: './src/index.js',
globals: { 'vue': 'Vue' },
moduleName: 'ELEMENT_TREE_COLUMN',
plugins: [
vue({
//there is sth. wrong with compileTemplate ,so use `template` instead
compileTemplate: false,
styleToImports: true
}),
nodeResolve({
browser: true,
// jsnext: true,
main: true,
skip: ['vue']
}),
babel({ runtimeHelpers: false }),
],
format: 'cjs'
};
gulp.task('commonjs',()=>{
return gulp.src(['./src/*.js', './src/*.vue'])
.pipe(rollup(rollupConfigCommon))
.pipe(rename('tree-table.common.js'))
.pipe(gulp.dest('./dist'))
});
gulp.task('dev', () => {
return gulp.src(['./src/*.js', './src/*.vue'])
.pipe(rollup(rollupConfig))
.pipe(rename('tree-table.js'))
.pipe(gulp.dest('./dist'))
});
gulp.task('dev-min', () => {
return gulp.src(['./src/*.js', './src/*.vue'])
.pipe(rollup(rollupConfig))
.pipe(uglify())
.pipe(rename('tree-table.min.js'))
.pipe(gulp.dest('./dist'))
});
gulp.task('watch',()=>{
gulp.watch(['./src/*.js', './src/*.vue'],['dev','dev-min','commonjs'])
})
gulp.task('default',['dev','dev-min','watch'])