This repository has been archived by the owner on Mar 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
68 lines (61 loc) · 2.05 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
'use strict';
var gulp = require('gulp'),
glob = require('glob'),
bless = require('gulp-bless'),
sass = require('gulp-sass'),
sassLint = require('gulp-sass-lint'),
sassGlob = require('gulp-sass-glob'),
cleanCSSMinify = require('gulp-clean-css'),
watch = require('gulp-watch'),
rename = require('gulp-rename'),
gzip = require('gulp-gzip'),
notify = require('gulp-notify'),
sourcemaps = require('gulp-sourcemaps'),
livereload = require('gulp-livereload');
var templatesPath = 'tuneme/templates/new';
var sassPaths = [
'tuneme/styles/tuneme/style-320.s+(a|c)ss',
'tuneme/styles/tuneme/style-opera.s+(a|c)ss',
'tuneme/styles/tuneme/style-rtl.s+(a|c)ss',
'tuneme/styles/tuneme/style.s+(a|c)ss',
'tuneme/styles/tuneme/style-global_site.s+(a|c)ss',
];
var sassDest = {
prd: 'tuneme/static/new/css/prd',
dev: 'tuneme/static/new/css/dev'
};
function styles(env) {
var s = gulp.src(sassPaths);
var isDev = env === 'dev';
if (isDev) s = s
.pipe(sourcemaps.init());
s = s
.pipe(sassGlob())
.pipe(sass().on('error', sass.logError))
.pipe(bless())
.pipe(cleanCSSMinify())
if (isDev) s = s
.pipe(sourcemaps.write('/maps'));
return s
.pipe(gulp.dest(sassDest[env]))
.pipe(notify({ message: `Styles task complete: ${env}` }));
}
gulp.task('styles:prd', function() {
return styles('prd');
});
gulp.task('styles:dev', function() {
return styles('dev');
});
gulp.task('serve', function() {
browserSync.init({
'proxy': 'localhost:8000/'
});
gulp.watch(sassPaths + '/**/*.scss', ['styles:dev', 'styles:prd']);
gulp.watch(templatesPath + '/**/*.html').on('change', reload);
});
gulp.task('watch', function() {
livereload.listen();
gulp.watch('tuneme/styles/tuneme/**/**.scss', ['styles']);
});
gulp.task('styles', ['styles:dev', 'styles:prd']);
gulp.task('default', ['styles']);