-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
38 lines (32 loc) · 1.05 KB
/
Copy pathgulpfile.js
File metadata and controls
38 lines (32 loc) · 1.05 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
var gulp = require('gulp');
var browserSync = require('browser-sync'); /*to serve on localhost*/
var sass = require('gulp-sass'); /*to use sass*/
var inject = require('gulp-inject'); /*to inject dependencies in index*/
/*to serve on localhost*/
gulp.task('browserSync', function() {
browserSync({
server: {
baseDir: 'app'
},
})
})
/*to use sass*/
gulp.task('sass', function() {
return gulp.src('app/scss/**/*.scss') // Gets all files ending with .scss in app/scss
.pipe(sass())
.pipe(gulp.dest('app/css'))
.pipe(browserSync.reload({
stream: true
}))
});
gulp.task('watch', ['browserSync', 'sass'], function (){
gulp.watch('app/scss/**/*.scss', ['sass']);
gulp.watch('app/index.html', ['browserSync']);
})
/*to inject dependencies in index*/
gulp.task('inject', function () {
var target = gulp.src('app/index.html');
var sources = gulp.src(['/css/*.css', 'bower_components/**/*.css', 'bower_components/**/*.js', '/components/**/*.js'], {read: false});
return target.pipe(inject(sources))
.pipe(gulp.dest('app'));
});