-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathgulpfile.js
More file actions
48 lines (40 loc) · 1.39 KB
/
Copy pathgulpfile.js
File metadata and controls
48 lines (40 loc) · 1.39 KB
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
const gulp = require('gulp')
const sass = require('gulp-sass')
const rename = require('gulp-rename')
const browserSync = require('browser-sync')
const php = require('gulp-connect-php')
const postcss = require("gulp-postcss");
const autoprefixer = require('autoprefixer');
const cssnano = require("cssnano");
var reload = browserSync.reload
var input = './sass/*'
var output = './public/styles/'
gulp.task('sass', function () {
return gulp
.src(input)
.pipe(sass({indentedSyntax: true}))
.pipe(postcss([autoprefixer({overrideBrowserslist: ['last 8 versions', '> 1%', 'ie 8', 'ie 7']})]))
.pipe(gulp.dest(output))
.pipe(rename({suffix: '.min'}))
.pipe(postcss([cssnano(), autoprefixer({overrideBrowserslist: ['last 8 versions', '> 1%', 'ie 8', 'ie 7']})]))
.pipe(gulp.dest(output))
.pipe(reload({stream: true}))
})
/* Reload task */
gulp.task('bs-reload', function () {
browserSync.reload()
})
/* Prepare Browser-sync for localhost */
gulp.task('browser-sync', function () {
browserSync.init(['public/styles/*.css', 'public/pages/*.php', 'public/components/*.php'], {
proxy: 'localhost:8010',
port: 3020,
open: true,
notify: false
})
})
gulp.task('watch', function () {
return gulp
.watch(input, gulp.parallel('sass'))
})
gulp.task('default', gulp.parallel('sass', 'watch', 'browser-sync'))