-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
53 lines (46 loc) · 1.4 KB
/
gulpfile.js
File metadata and controls
53 lines (46 loc) · 1.4 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
49
50
51
52
53
var gulp = require('gulp');
var sass = require('gulp-sass');
var browserSync = require('browser-sync').create();
//Sample Task For Checking Purpose Only.
gulp.task('sample',()=>{
console.log("Hi !! I am inside the sample gulp task");
});
//Task for converting Single SCSS file to CSS using gulp-sass.
gulp.task('sample',()=>{
return gulp.src('app/scss/style.scss')
.pipe(sass())
.pipe(gulp.dest('app/css'))
});
//Task for converting multiple SCSS file to multiple CSS in single run.
gulp.task('sass',()=>{
return (gulp.src('app/scss/**/*.scss')
.pipe(sass())
.pipe(gulp.dest('app/css')))
});
//Task for Watching any changes in the below type of files.
gulp.task('watch',()=>{
gulp.watch('app/scss/**/*.scss',['browserSASS']);
});
//Task for spin up a server using browser sync.
gulp.task('browserSync',()=>{
browserSync.init({
server:{
basedir:'app'
},
})
});
//Task for converting multiple sass into multiple CSS in single run along with browserSync task.
gulp.task('browserSASS',()=>{
return gulp.src('app/scss/**/*.scss')
.pipe(sass())
.pipe(gulp.dest('app/css'))
.pipe(browserSync.reload({
stream:true
}))
});
//Task for Watching any changes in the below type of files and before that run browserSync.
gulp.task('watch',['browserSync'],()=>{
gulp.watch('app/scss/**/*.scss',['browserSASS']);
gulp.watch('app/*.html', browserSync.reload);
gulp.watch('app/js/**/*.js',browserSync.reload);
});