forked from peymanslh/iranmap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
59 lines (50 loc) · 1.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
var gulp = require('gulp');
var newer = require('gulp-newer');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var connect = require('gulp-connect');
var pkg = require('./package.json');
/*
* Gulp tasks setting
* */
var devBuild = ((process.env.NODE_ENV || 'development').trim().toLowerCase() !== 'production');
var scss = {
in: ['src/scss/map.scss', 'src/scss/style.scss'],
watch: ['src/scss/**/*'],
out: 'css/',
sassOpts: {
outputStyle: function() {
devBuild ? 'nested' : 'compressed';
},
imagePath: '../images',
precision: 8,
errLogToConsole: true
}
};
var connectOpts = {
port: '3000',
root: '',
livereload: true
}
console.log(pkg.name + ' ' + pkg.version + ', ' + (devBuild ? 'development' : 'production') + ' build');
/*
* Gulp tasks
* */
gulp.task('clean', function() {
del([
'css/*'
]);
});
gulp.task('connect', function() {
connect.server(connectOpts);
});
gulp.task('sass', function() {
return gulp.src(scss.in)
.pipe(sass(scss.sassOpts))
.pipe(autoprefixer("last 5 version", "> 1%", "ie 8"))
.pipe(gulp.dest(scss.out))
.pipe(connect.reload(connectOpts));
});
gulp.task('default', ['sass', 'connect'], function() {
gulp.watch(scss.watch, ['sass']);
});