-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
94 lines (81 loc) · 2.44 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
'use strict';
var gulp = require('gulp'),
concat = require('gulp-concat'),
path = require('path'),
sass = require('gulp-sass'),
minifycss = require('gulp-minify-css'),
autoprefixer = require('gulp-autoprefixer'),
livereload = require('gulp-livereload'),
uglify = require('gulp-uglify');
// styles
gulp.task('styles:dev', function () {
return gulp.src('sass/main.scss')
.pipe(sass()).on('error', sass.logError)
.pipe(concat('main.css'))
.pipe(autoprefixer({
browsers: ['last 3 versions'],
cascade: false
}))
.pipe(gulp.dest('css'))
.pipe(livereload());
});
gulp.task('styles:prod', function () {
return gulp.src('sass/main.scss')
.pipe(sass()).on('error', sass.logError)
.pipe(concat('main.min.css'))
.pipe(autoprefixer({
browsers: ['last 3 versions'],
cascade: false
}))
.pipe(minifycss())
.pipe(gulp.dest('css'));
});
gulp.task('styles:ie', function () {
return gulp.src('sass/ie.scss')
.pipe(sass()).on('error', sass.logError)
.pipe(concat('ie.min.css'))
.pipe(minifycss())
.pipe(gulp.dest('css'));
});
gulp.task('styles', ['styles:dev', 'styles:prod', 'styles:ie']);
// scripts
gulp.task('scripts:top:dev', function () {
return gulp.src([
'javascripts/vendor/modernizr.js',
'javascripts/vendor/plugins.js'
])
.pipe(concat('top.js'))
.pipe(gulp.dest('js'));
});
gulp.task('scripts:top:prod', function () {
return gulp.src([
'javascripts/vendor/modernizr.js',
'javascripts/vendor/plugins.js'
])
.pipe(concat('top.min.js'))
.pipe(uglify())
.pipe(gulp.dest('js'));
});
gulp.task('scripts:main:dev', function () {
return gulp.src([
'javascripts/vendor/slick.js',
'javascripts/main.js'
])
.pipe(concat('main.js'))
.pipe(gulp.dest('js'));
});
gulp.task('scripts:main:prod', function () {
return gulp.src([
'javascripts/vendor/slick.js',
'javascripts/main.js'
])
.pipe(concat('main.min.js'))
.pipe(uglify())
.pipe(gulp.dest('js'));
});
gulp.task('scripts', ['scripts:top:dev', 'scripts:top:prod', 'scripts:main:dev', 'scripts:main:prod']);
gulp.task('watch', function() {
livereload.listen();
gulp.watch('sass/**/*.scss', ['styles']);
gulp.watch('javascripts/**/*.js', ['scripts']);
});