-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
48 lines (39 loc) · 1.38 KB
/
Copy pathgulpfile.js
File metadata and controls
48 lines (39 loc) · 1.38 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 autoprefixer = require('gulp-autoprefixer');
const cssnano = require('gulp-cssnano');
const path = require('path');
var browserSync = require('browser-sync').create();
const SASS_INCLUDE_PATHS = [
path.join(__dirname, '/node_modules/breakpoint-sass/stylesheets'),
path.join(__dirname, '/node_modules/breakpoint-slicer/stylesheets'),
path.join(__dirname, '/node_modules/ress'),
path.join(__dirname, '/node_modules/bootstrap/scss/')
];
gulp.task('build', function () {
return gulp.src('assets/styles/main.scss')
.pipe(sass({ includePaths: SASS_INCLUDE_PATHS }).on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(cssnano({
discardComments: {removeAll: true}
}))
.pipe(gulp.dest('./public/css'));
});
gulp.task('serve', ['sass'], function() {
browserSync.init({
server: "./public"
});
gulp.watch("assets/styles/**/*.scss", ['sass']);
gulp.watch("public/*.html").on('change', browserSync.reload);
});
// Compile sass into CSS & auto-inject into browsers
gulp.task('sass', function() {
return gulp.src("assets/styles/*.scss")
.pipe(sass({ includePaths: SASS_INCLUDE_PATHS }).on('error', sass.logError))
.pipe(gulp.dest("public/css"))
.pipe(browserSync.stream());
});
gulp.task('default', ['serve']);