-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathgulpfile.js
52 lines (44 loc) · 1.2 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
'use strict';
var gulp = require('gulp'),
browserSync = require('browser-sync').create(),
rename = require("gulp-rename"),
sass = require('gulp-sass');
var reload = browserSync.reload;
var path = {
html: './**/*.html',
scss: 'src/sass/**/*.scss',
js: 'src/js/**/*.js',
dist: {
css: 'css',
js: 'js'
}
};
gulp.task('cp-normalize', function() {
gulp.src([
'./node_modules/normalize.scss/normalize.scss'
])
.pipe(rename('_normalize.scss'))
.pipe(gulp.dest('./src/sass/base/'));
});
// copy vendor libraries into app
gulp.task('cp', ['cp-normalize']);
// BrowserSync static server + watching scss and html files
gulp.task('server', ['sass'], function() {
browserSync.init({
server: {
baseDir: './',
directory: false,
index: 'index.html'
}
});
gulp.watch(path.scss, ['sass']);
gulp.watch(path.html).on('change', reload);
});
// Compile sass into css
gulp.task('sass', function() {
return gulp.src(path.scss)
.pipe(sass())
.pipe(gulp.dest(path.dist.css))
.pipe(reload({stream: true}));
});
gulp.task('default', ['server']);