-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
69 lines (58 loc) · 1.77 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var babel = require('gulp-babel');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');
var jsVendor = [
'node_modules/jquery/dist/jquery.js',
'node_modules/bootstrap-sass/assets/javascripts/bootstrap.js',
];
var cssVendor = [
'node_modules/purecss/build/menus.css',
];
var sassImports = [
'node_modules/bootstrap-sass/assets/stylesheets',
];
gulp.task('css:app', function() {
gulp.src('assets/css/*.{scss,sass}')
.pipe(sourcemaps.init())
.pipe(sass({
includePaths: sassImports,
outputStyle: 'expanded',
precision: 8,
}).on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('build/css'));
});
gulp.task('css:vendor', function() {
gulp.src(cssVendor)
.pipe(concat('vendor.css'))
.pipe(gulp.dest('build/css'))
});
gulp.task('css', ['css:app', 'css:vendor']);
gulp.task('js:app', function() {
gulp.src('assets/js/*.js')
.pipe(sourcemaps.init())
.pipe(babel({
presets: ['latest'],
}))
.pipe(concat('app.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('build/js'));
});
gulp.task('js:vendor', function() {
gulp.src(jsVendor)
.pipe(concat('vendor.js'))
.pipe(gulp.dest('build/js'));
});
gulp.task('js', ['js:app', 'js:vendor']);
gulp.task('watch', function() {
gulp.watch('assets/css/*.{scss,sass}', ['css:app']);
gulp.watch('assets/js/*.js', ['js:app']);
});
gulp.task('default', ['css:vendor', 'css:app', 'js:vendor', 'js:app']);