-
Notifications
You must be signed in to change notification settings - Fork 62
/
gulpfile.js
71 lines (58 loc) · 2.38 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
var gulp = require('gulp');
var liveReload = require('gulp-livereload');
var inlinesource = require('gulp-inline-source');
var htmlmin = require('gulp-htmlmin');
gulp.task('default', ['watch']);
gulp.task('release', ['inline-into-php']);
gulp.task('watch', ['copy-all'], watchTask);
gulp.task('copy-all', ['copy-from-docs','copy-from-ag-grid','copy-from-ag-grid-enterprise','copy-from-libs']);
gulp.task('copy-from-ag-grid', copyFromAgGrid);
gulp.task('copy-from-ag-grid-enterprise', copyFromAgGridEnterprise);
gulp.task('copy-from-docs', copyFromDocs);
gulp.task('copy-from-libs', ['copy-bootstrap','copy-font-awesome']);
gulp.task('inline-into-php', ['copy-from-docs','copy-from-ag-grid','copy-from-ag-grid-enterprise'], inlineIntoPhp);
gulp.task('copy-bootstrap', function() {
return gulp.src([
'./node_modules/bootstrap/dist/js/bootstrap.js',
'./node_modules/bootstrap/dist/css/bootstrap.css',
'./node_modules/bootstrap/dist/css/bootstrap-theme.css'
])
.pipe(gulp.dest('./dist/dist'));
});
gulp.task('copy-font-awesome', function() {
return gulp.src([
'./node_modules/font-awesome/css/font-awesome.css',
'./node_modules/font-awesome/fonts/*'
]
, {base: './node_modules/font-awesome'}
)
.pipe(gulp.dest('./dist/dist/font-awesome'));
});
function copyFromAgGrid() {
return gulp.src(['../ag-grid/dist/ag-grid.js'])
.pipe(gulp.dest('./dist/dist'))
.pipe(liveReload());
}
function copyFromAgGridEnterprise() {
return gulp.src(['../ag-grid-enterprise/dist/ag-grid-enterprise.js'])
.pipe(gulp.dest('./dist/dist'))
.pipe(liveReload());
}
function copyFromDocs() {
return gulp.src(['./src/**/*'])
.pipe(gulp.dest('./dist'));
}
function inlineIntoPhp() {
return gulp.src(['./dist/**/*.php'])
.pipe(inlinesource())
// this plugin couldn't handle javascript examples in the documentation, and also messed up the
// layout of the index.html features list (the diamond separated list)
//.pipe(htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest('./dist'));
}
function watchTask() {
liveReload.listen();
gulp.watch('../ag-grid/dist/ag-grid.js', ['copy-from-ag-grid']);
gulp.watch('../ag-grid-enterprise/dist/ag-grid-enterprise.js', ['copy-from-ag-grid-enterprise']);
gulp.watch('./src/**/*', ['copy-from-docs']);
}