-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
70 lines (63 loc) · 1.56 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
const path = require('path');
const gulp = require('gulp');
const babel = require('gulp-babel');
const cachebust = require('gulp-cache-bust');
const autoprefixer = require('gulp-autoprefixer');
const csso = require('gulp-csso');
const runSequence = require('run-sequence');
const sass = require('gulp-sass');
const uglify = require('gulp-uglify');
const dist = path.resolve(__dirname, 'public');
const AUTOPREFIXER_BROWSERS = [
'ie >= 11',
'ie_mob >= 11',
'ff >= 52',
'chrome >= 34',
'safari >= 10.1',
'opera >= 54',
'ios >= 9.3',
'android >= 4.4',
'bb >= 10'
];
gulp.task('styles', function () {
return gulp.src('./css/styles.scss')
.pipe(sass({
outputStyle: 'nested',
precision: 10,
onError: console.error.bind(console, 'Sass error:')
}))
.pipe(autoprefixer({browsers: AUTOPREFIXER_BROWSERS}))
.pipe(csso())
.pipe(gulp.dest(path.join(dist, '/css')))
});
gulp.task('morph', function() {
return gulp.src('./js/morph.js')
.pipe(babel())
.pipe(uglify())
.pipe(gulp.dest(path.join(dist, '/js')))
});
gulp.task('scripts', function() {
return gulp.src('./js/main.js')
.pipe(uglify())
.pipe(gulp.dest(path.join(dist, '/js')))
});
gulp.task('html', function() {
return gulp.src('./index.html')
.pipe(cachebust({
basePath: 'public/'
}))
.pipe(gulp.dest(dist));
});
gulp.task('favicon', function() {
return gulp.src('./favicon.ico')
.pipe(gulp.dest(dist));
});
gulp.task('default', null, function () {
runSequence(
'styles',
'html',
'favicon',
'scripts',
'morph',
);
});