forked from flextype-plugins/admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·94 lines (86 loc) · 3.64 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
//
// Flextype Admin Gulp.js
// (c) Sergey Romanenko <https://github.com/Awilum>
//
var Promise = require("es6-promise").Promise,
gulp = require('gulp'),
csso = require('gulp-csso'),
concat = require('gulp-concat'),
del = require('del'),
runSequence = require('run-sequence'),
sourcemaps = require('gulp-sourcemaps'),
autoprefixer = require('gulp-autoprefixer'),
sass = require('gulp-sass');
gulp.task('admin-css', function() {
return gulp.src('assets/scss/admin.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(csso())
.pipe(concat('admin.min.css'))
.pipe(gulp.dest('assets/dist/css/'));
});
gulp.task('admin-css-clean', function() {
return del('assets/dist/css/admin.min.css');
});
gulp.task('build-css', function(){
return gulp.src(['node_modules/bootstrap/dist/css/bootstrap.min.css',
'node_modules/animate.css/animate.min.css',
'node_modules/trumbowyg/dist/ui/trumbowyg.min.css',
'node_modules/trumbowyg/dist/plugins/table/ui/trumbowyg.table.css',
'node_modules/codemirror/lib/codemirror.css',
'node_modules/codemirror/theme/monokai.css',
'node_modules/messenger-hubspot/build/css/messenger.css',
'node_modules/messenger-hubspot/build/css/messenger-theme-flat.css',
'assets/dist/css/admin.min.css'])
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(sourcemaps.init())
.pipe(concat('build.min.css'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('assets/dist/css/'));
});
gulp.task('js', function(){
return gulp.src(['node_modules/jquery/dist/jquery.min.js',
'node_modules/popper.js/dist/umd/popper.min.js',
'node_modules/bootstrap/dist/js/bootstrap.min.js',
'node_modules/trumbowyg/dist/trumbowyg.min.js',
'node_modules/trumbowyg/dist/plugins/noembed/trumbowyg.noembed.js',
'node_modules/trumbowyg/dist/plugins/table/trumbowyg.table.js',
'node_modules/codemirror/lib/codemirror.js',
'node_modules/codemirror/lib/codemirror.js',
'node_modules/codemirror/mode/htmlmixed/htmlmixed.js',
'node_modules/codemirror/mode/xml/xml.js',
'node_modules/codemirror/mode/javascript/javascript.js',
'node_modules/codemirror/mode/php/php.js',
'node_modules/codemirror/mode/clike/clike.js',
'node_modules/codemirror/mode/yaml/yaml.js',
'node_modules/messenger-hubspot/build/js/messenger.min.js',
'node_modules/messenger-hubspot/build/js/messenger-theme-flat.js'
])
.pipe(sourcemaps.init())
.pipe(concat('build.min.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('assets/dist/js/'));
});
gulp.task('trumbowyg-fonts', function(){
return gulp.src(['node_modules/trumbowyg/dist/ui/icons.svg'])
.pipe(gulp.dest('assets/dist/fonts/trumbowyg'));
});
gulp.task('trumbowyg-langs', function(){
return gulp.src(['node_modules/trumbowyg/dist/*langs/**/*'])
.pipe(gulp.dest('assets/dist/langs/trumbowyg'));
});
gulp.task('default', function(callback) {
runSequence('admin-css',
['build-css',
'trumbowyg-fonts',
'trumbowyg-langs',
'js'],
'admin-css-clean',
callback);
});