forked from Sylius/Sylius
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
86 lines (73 loc) · 2.45 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
var gulp = require('gulp');
var gulpif = require('gulp-if');
var uglify = require('gulp-uglify');
var uglifycss = require('gulp-uglifycss');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var debug = require('gulp-debug');
var livereload = require('gulp-livereload');
var order = require('gulp-order');
var merge = require('merge-stream');
var env = process.env.GULP_ENV;
var rootPath = 'web/assets/';
var adminRootPath = rootPath + 'admin/';
var paths = {
admin: {
js: [
'node_modules/jquery/dist/jquery.min.js',
'node_modules/semantic-ui-css/semantic.min.js',
'src/Sylius/Bundle/UiBundle/Resources/private/js/**',
'src/Sylius/Bundle/ShippingBundle/Resources/public/js/**',
],
sass: [
'src/Sylius/Bundle/UiBundle/Resources/private/sass/**',
],
css: [
'node_modules/semantic-ui-css/semantic.min.css',
],
img: [
'src/Sylius/Bundle/UiBundle/Resources/private/img/**',
]
}
};
gulp.task('admin-js', function () {
return gulp.src(paths.admin.js)
.pipe(concat('app.js'))
.pipe(gulpif(env === 'prod', uglify))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(adminRootPath + 'js/'))
;
});
gulp.task('admin-css', function() {
gulp.src(['node_modules/semantic-ui-css/themes/**/*']).pipe(gulp.dest(adminRootPath + 'css/themes/'));
var cssStream = gulp.src(paths.admin.css)
.pipe(concat('css-files.css'))
;
var sassStream = gulp.src(paths.admin.sass)
.pipe(sass())
.pipe(concat('sass-files.scss'))
;
return merge(cssStream, sassStream)
.pipe(order(['css-files.css', 'sass-files.scss']))
.pipe(concat('style.css'))
.pipe(gulpif(env === 'prod', uglifycss))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(adminRootPath + 'css/'))
.pipe(livereload())
;
});
gulp.task('admin-img', function() {
return gulp.src(paths.admin.img)
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(adminRootPath + 'img/'))
;
});
gulp.task('admin-watch', function() {
livereload.listen();
gulp.watch(paths.admin.js, ['admin-js']);
gulp.watch(paths.admin.sass, ['admin-css']);
gulp.watch(paths.admin.css, ['admin-css']);
gulp.watch(paths.admin.img, ['admin-img']);
});
gulp.task('default', ['admin-js', 'admin-css', 'admin-img']);