-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
47 lines (41 loc) · 1.14 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
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
var reload = browserSync.reload;
var src = {
scss: 'src/*.sass',
css: 'css',
html: '*.html'
};
// Static Server + watching scss/html files
gulp.task('serve', ['sass'], function() {
browserSync.init({
server: './app'
});
gulp.watch(src.scss, ['sass']);
gulp.watch(src.html).on('change', reload);
});
// Compile sass into CSS
gulp.task('sass', function() {
return gulp
var plugins = [
autoprefixer({browsers: ['last 1 version']}),
cssnano()
];
.src(src.sass)
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest(src.css))
return gulp.src(src.css)
.pipe(postcss(plugins))
.pipe(gulp.dest(src.css))
.pipe(reload({ stream: true }));
});
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
var cssnano = require('cssnano');
gulp.task('css', function () {
return gulp.src('./src/*.css')
.pipe(postcss(plugins))
.pipe(gulp.dest('./dest'));
});
gulp.task('default', ['serve']);