-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
76 lines (67 loc) · 2.32 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefix = require('gulp-autoprefixer'),
notify = require("gulp-notify"),
bower = require('gulp-bower'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
browserSync = require('browser-sync'),
reload = browserSync.reload;
var config = {
sassPath: './resources/sass',
bowerDir: './bower_components',
};
gulp.task('bower', function() {
return bower().pipe(gulp.dest(config.bowerDir));
});
gulp.task('icons', function() {
gulp.src(config.bowerDir + '/fontawesome/fonts/**.*').pipe(gulp.dest('./public/fonts'));
return gulp.src(config.bowerDir + '/bootstrap-sass-official/assets/fonts/bootstrap/**.*').pipe(gulp.dest('./public/fonts/bootstrap'));
});
gulp.task('css', function() {
return gulp.src(config.sassPath + '/style.sass')
.pipe(
sass({
"sourcemap=none": true,
style: 'compressed',
loadPath: [
'./resources/sass',
config.bowerDir + '/bootstrap-sass-official/assets/stylesheets',
config.bowerDir + '/fontawesome/scss',
]
})
.on("error", notify.onError(function(error) {
return "Error: " + error.message;
}))
)
.pipe(autoprefix('last 2 version'))
.pipe(gulp.dest('./public/css'))
.pipe(reload({
stream: true
}));
});
gulp.task('compress', function() {
gulp.src([
config.bowerDir + '/jquery/dist/jquery.js',
config.bowerDir + '/bootstrap-sass-official/assets/javascripts/bootstrap.js',
config.bowerDir + '/bootstrap-sass-official/assets/javascripts/bootstrap/collapse.js'
])
.pipe(concat('script.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./public/js'));
});
gulp.task('browser-sync', function() {
browserSync({
server: {
baseDir: "./public"
}
});
});
// reload all browsers
gulp.task('bs-reload', function() {
browserSync.reload();
});
gulp.task('default', ['bower', 'icons', 'css', 'compress', 'browser-sync'], function() {
gulp.watch([config.sassPath + '/**/*.scss', config.sassPath + '/**/*.sass'], ['css']);
gulp.watch('./public/*.html',['bs-reload']);
});