-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
66 lines (55 loc) · 2.33 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
'use strict';
var gulp = require('gulp');
var watch = require('gulp-watch');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var rename = require('gulp-rename');
var paths = {
scss_backend: [ 'core/assets/css/scss/**/*.scss', 'core/assets/css/' ],
scss_frontend: [ 'core/assets/css_front/scss/**/*.scss', 'core/assets/css_front/' ],
frontend_js: ['core/assets/js/init.js', '**/*.frontend.js'],
all_js: ['core/assets/js/init.js', '**/*.backend.js'],
};
gulp.task('build_scss_backend', function () {
return gulp.src(paths.scss_backend[0])
.pipe( sass.sync().on( 'error', sass.logError ) )
.pipe( gulp.dest( paths.scss_backend[1] ) )
.pipe( sass.sync({outputStyle: 'compressed'}).on( 'error', sass.logError ) )
.pipe( rename( './style.min.css' ) )
.pipe( gulp.dest( paths.scss_backend[1] ) );
});
gulp.task('build_scss_backend_min', function () {
return gulp.src(paths.scss_backend[0])
.pipe( sass.sync({outputStyle: 'compressed'}).on( 'error', sass.logError ) )
.pipe( gulp.dest( paths.scss_backend[1] ) );
});
gulp.task('build_scss_frontend', function () {
return gulp.src(paths.scss_frontend[0])
.pipe( sass.sync().on( 'error', sass.logError ) )
.pipe( gulp.dest( paths.scss_frontend[1] ) )
.pipe( sass.sync({outputStyle: 'compressed'}).on( 'error', sass.logError ) )
.pipe( rename( './style.min.css' ) )
.pipe( gulp.dest( paths.scss_frontend[1] ) );
});
gulp.task('build_scss_frontend_min', function () {
return gulp.src(paths.scss_frontend[0])
.pipe( sass.sync({outputStyle: 'compressed'}).on( 'error', sass.logError ) )
.pipe( gulp.dest( paths.scss_frontend[1] ) );
});
gulp.task('js', function () {
return gulp.src(paths.all_js)
.pipe(concat('backend.min.js'))
.pipe(gulp.dest('core/assets/js/'))
})
gulp.task('js_frontend', function () {
return gulp.src(paths.frontend_js)
.pipe(concat('frontend.min.js'))
.pipe(gulp.dest('core/assets/js/'))
})
gulp.task('default', function () {
gulp.watch(paths.scss_backend[0], gulp.series("build_scss_backend"));
gulp.watch(paths.scss_frontend[0], gulp.series("build_scss_frontend"));
// gulp.watch(paths.scss_backend[0], gulp.series("build_scss_backend_min"));
gulp.watch(paths.all_js, gulp.series("js"));
gulp.watch(paths.frontend_js, gulp.series("js_frontend"));
});