This repository has been archived by the owner on Mar 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
62 lines (51 loc) · 1.66 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
// ==================================================
// Gulp Variables
// ==================================================
var debug = true;
var notification = true;
var gulp = require('gulp'),
notify = require('gulp-notify'),
sass = require('gulp-sass'),
sourcemaps = require('gulp-sourcemaps'),
autoprefixer = require('autoprefixer'),
postcss = require('gulp-postcss'),
inline_base64 = require('gulp-inline-base64'),
livereload = require('gulp-livereload');
// ==================================================
// Set Paths
// ==================================================
var sass_path = 'resources/assets/sass/';
var css_path = 'public/css/';
var css_images_path = 'public/css/images/';
// ==================================================
// Tasks
// ==================================================
gulp.task('default', function () {
var g = gulp.src(sass_path + '/**/*.scss')
.pipe(sass({
outputStyle: (debug) ? 'compact' : 'compressed',
imagePath: css_images_path
}).on('error', sass.logError))
.pipe(inline_base64({
baseDir: css_images_path,
maxSize: 14 * 1024,
debug: debug
}))
.pipe(postcss([autoprefixer({
browsers: ['last 4 versions']
})]))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(css_path))
.pipe(livereload());
if (notification) {
g.pipe(notify('Yup!'));
}
});
gulp.task('watch', function () {
gulp.watch(sass_path + '**/*.scss', ['default']);
});
gulp.task('livereload', function () {
notification = false;
livereload.listen();
gulp.start('watch');
});