-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
76 lines (64 loc) · 1.99 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');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var minifyCss = require('gulp-minify-css');
var browserSync = require('browser-sync').create();
var config = {};
//basics
config.siteName = 'Brandish Insights';
config.proxyDomain = 'https://newbr.test';
config.key = '~/.localhost/key.pem';
config.cert = '~/.localhost/cert.pem';
var sassOptions = {
errLogToConsole: true,
outputStyle: 'expanded'
};
// Compile sass
gulp.task('sass', function () {
gulp.src('web/components/styles/**/*')
.pipe(sourcemaps.init().on('error', sass.logError))
.pipe(sass(sassOptions).on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./web/css'))
.pipe(browserSync.stream());
});
// Uglify Javascripts
gulp.task('compress', function() {
return gulp.src('web/components/scripts/**/*.js')
// .pipe(uglify())
.pipe(gulp.dest('js'));
});
// Watching files
gulp.task('watch', function() {
browserSync.init({
proxy: config.proxyDomain
});
gulp.watch("web/components/scripts/**/*.js", ['compress']);
gulp.watch("web/components/styles/**/*", ['sass']);
gulp.watch("*.html", "*.twig").on('change', browserSync.reload);
});
// Uglify Plugins
gulp.task('uglifyPlugins', function() {
return gulp.src(['web/components/libs/bootstrap-sass/assets/javascripts/bootstrap.js',
'web/components/libs/jquery/dist/jquery.js'])
.pipe(rename({
suffix: ".min",
extname: ".js"
}))
.pipe(uglify())
.pipe(gulp.dest('js'));
});
// // Minify Plugins CSS files
// gulp.task('minifyPlugins', function() {
// return gulp.src(['components/libs/bootstrap/dist/css/bootstrap.css'])
// .pipe(rename({
// suffix: ".min",
// extname: ".css"
// }))
// .pipe(minifyCss({compatibility: 'ie9'}))
// .pipe(gulp.dest('css'));
// });
gulp.task('build', ['uglifyPlugins', 'minifyPlugins']);
gulp.task('default', ['watch']);