forked from New0/direct-stripe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
88 lines (82 loc) · 3.08 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
var gulp = require('gulp'),
plumber = require('gulp-plumber'),
rename = require('gulp-rename');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var imagemin = require('gulp-imagemin'),
cache = require('gulp-cache');
var sass = require('gulp-sass');
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
gulp.task('public-images', function(){
gulp.src('assets/public/src/img/**/*')
.pipe(cache(imagemin({ optimizationLevel: 3, progressive: true, interlaced: true })))
.pipe(gulp.dest('assets/public/dist/img/'));
});
gulp.task('admin-images', function(){
gulp.src('assets/admin/src/img/**/*')
.pipe(cache(imagemin({ optimizationLevel: 3, progressive: true, interlaced: true })))
.pipe(gulp.dest('assets/admin/dist/img/'));
});
gulp.task('public-styles', function(){
var options = {
outputStyle: 'compressed',
};
gulp.src(['assets/public/src/scss/**/*.scss'])
.pipe(plumber({
errorHandler: function (error) {
console.log(error.message);
this.emit('end');
}}))
.pipe(sass(options))
.pipe(postcss([ autoprefixer({ browsers: ['last 5 versions'] }) ]))
.pipe(gulp.dest('assets/public/dist/css/'))
});
gulp.task('admin-styles', function(){
var options = {
outputStyle: 'compressed',
};
gulp.src(['assets/admin/src/scss/**/*.scss'])
.pipe(plumber({
errorHandler: function (error) {
console.log(error.message);
this.emit('end');
}}))
.pipe(sass(options))
.pipe(postcss([ autoprefixer({ browsers: ['last 5 versions'] }) ]))
.pipe(gulp.dest('assets/admin/dist/css/'))
});
gulp.task('public-scripts', function(){
return gulp.src('assets/public/src/js/**/*.js')
.pipe(plumber({
errorHandler: function (error) {
console.log(error.message);
this.emit('end');
}}))
.pipe(concat('main.js'))
.pipe(gulp.dest('assets/public/dist/js/'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('assets/public/dist/js/'))
});
gulp.task('admin-scripts', function(){
return gulp.src('assets/admin/src/js/**/*.js')
.pipe(plumber({
errorHandler: function (error) {
console.log(error.message);
this.emit('end');
}}))
.pipe(concat('main.js'))
.pipe(gulp.dest('assets/admin/dist/js/'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('assets/admin/dist/js/'))
});
gulp.task('direct-stripe', function(){
gulp.watch("assets/public/src/scss/**/*.scss", ['public-styles']);
gulp.watch("assets/admin/src/scss/**/*.scss", ['admin-styles']);
gulp.watch("assets/public/src/img/**/*", ['public-images']);
gulp.watch("assets/admin/src/img/**/*", ['admin-images']);
gulp.watch("assets/public/src/js/**/*.js", ['public-scripts']);
gulp.watch("assets/admin/src/js/**/*.js", ['admin-scripts']);
});