-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
34 lines (30 loc) · 1.17 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
const gulp = require('gulp')
const concat = require('gulp-concat')
const minifyJS = require('gulp-uglify')
const minifyCSS = require('gulp-clean-css')
const injectString = require('gulp-inject-string')
gulp.task('clean', () => {
return gulp.src(['./src/js/scripts.min.js', './src/css/styles.min.css'], { read: false, allowEmpty: true })
})
gulp.task('minify-js', () => {
return gulp.src('./src/js/scripts/*.js')
.pipe(concat('scripts.min.js'))
.pipe(minifyJS())
.pipe(injectString.prepend("'use strict'\n$(document).ready(function() {\n"))
.pipe(injectString.append('\n});'))
.pipe(gulp.dest('./src/js'))
})
gulp.task('minify-css', gulp.series('clean', () => {
return gulp.src([
'./src/css/styles/config.css',
'./src/css/styles/icons.css',
'./src/css/styles/header.css',
'./src/css/styles/sections.css',
'./src/css/styles/responsive.css',
'!./src/css/styles.min.css' // Exclui styles.min.css
])
.pipe(concat('styles.min.css'))
.pipe(minifyCSS())
.pipe(gulp.dest('./src/css'))
}))
gulp.task('default', gulp.parallel('minify-js', 'minify-css'))