-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
93 lines (88 loc) · 2.79 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
var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
uglifyjs = require('gulp-uglifyjs'),
imagemin = require('gulp-imagemin'),
pngquant = require('imagemin-pngquant'),
imageminSvgo = require('imagemin-svgo'),
spritesmith = require('gulp.spritesmith'),
svgSprite = require("gulp-svg-sprites"),
source = require('vinyl-source-stream'),
browserify = require('browserify'),
// watchify = require('watchify'),
vueify = require('vueify'),
envify = require('envify/custom');
gulp.task('vueify', function () {
browserify('resources/assets/js/app.js')
.transform(vueify)
.transform(
{ global: true },
envify({ NODE_ENV: 'production' })
)
.bundle()
.pipe(source('build.js'))
.pipe(gulp.dest("public/app/js/"))
});
//COMPILE SASS
gulp.task('sass', function(){
return gulp.src('public/app/sass/*.scss')
.pipe(sass())
.pipe(autoprefixer(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], { cascade: true }))
.pipe(gulp.dest('public/app/css'))
});
//MIN CSS
gulp.task('css-min', ['sass'], function() {
return gulp.src('public/app/css/*.css')
.pipe(cssnano())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('public/dist/css'));
});
//MIN SCRIPTS
gulp.task('scripts', function(){
return gulp.src([
'public/app/js/build.js'
])
.pipe(concat('build.min.js'))
.pipe(uglifyjs())
.pipe(gulp.dest('public/dist/js'));
});
//OPTIMIZATION IMAGES
gulp.task('img', function(){
return gulp.src('public/app/img/dunco-logo.png')
.pipe(imagemin({
interlaced: true,
progressive: true,
use: [
imageminSvgo({
plugins: [
{removeViewBox: false}
]
})
],
une: [pngquant()]
}))
.pipe(gulp.dest('public/dist/img'))
});
//SPRITES
gulp.task('sprite', function () {
var spriteData = gulp.src('public/app/img/icon/*.png').pipe(spritesmith({
imgName: 'sprite-menu.png',
cssName: 'sprite-menu.scss'
}));
return spriteData.pipe(gulp.dest('public/app/sprites/'));
});
gulp.task('sprites-svg', function () {
return gulp.src('public/app/img/icons-menu-svg/*.svg')
.pipe(svgSprite({
cssFile: "sprite-svg.scss"
}))
.pipe(gulp.dest("public/app/sprites"));
});
//WATCHER
gulp.task('watch', ['sass'], function() {
gulp.watch('public/app/sass/**/*.scss', ['sass']);
});
//the file libs.js consists of: