This repository has been archived by the owner on Jan 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
/
gulpfile.js
74 lines (67 loc) · 2.24 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
var gulp = require('gulp'),
gutil = require('gulp-util'),
notify = require('gulp-notify'),
jshint = require('gulp-jshint'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
browserSync = require('browser-sync'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
shell = require('gulp-shell'),
stylish = require('jshint-stylish');
// SASS compile, autoprefix and minify task
gulp.task('styles', function() {
return sass('assets/sass/cortana.scss')
.on('error', gutil.beep)
.on('error', notify.onError("Error: <%= error.message %>"))
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1'))
.pipe(minifycss())
.pipe(gulp.dest('theme-build/css'));
});
// CSS vendors concat and minify
gulp.task('css_vendors', function() {
gulp.src([
'vendors/Slidebars/dist/slidebars.css',
'vendors/angular-bootstrap/ui-bootstrap-csp.css'
])
.pipe(concat('vendors.css'))
.pipe(minifycss())
.pipe(gulp.dest('theme-build/css'))
});
// JS task
gulp.task('scripts', function() {
gulp.src('assets/js/*.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(concat('main.js'))
.pipe(gulp.dest('theme-build/js'))
.pipe(rename({ suffix: '.min' }))
.pipe(uglify())
.pipe(gulp.dest('theme-build/js'));
});
// JS vendors concat and minify
gulp.task('js_vendors', function() {
gulp.src([
'vendors/jquery/dist/jquery.js',
'vendors/Slidebars/dist/slidebars.js',
'vendors/angular/angular.js',
'vendors/angular-bootstrap/ui-bootstrap.js',
'vendors/angular-bootstrap/ui-bootstrap-tpls.js'
])
.pipe(concat('vendors.min.js'))
.pipe(uglify())
.pipe(gulp.dest('theme-build/js'));
});
gulp.task('browser-sync', function() {
browserSync.init(['theme-build/css/*.css', '*.html', 'theme-build/js/*.js'], {
proxy: 'localhost',
open: false
});
});
gulp.task('default', ['watch', 'js_vendors', 'css_vendors', 'styles', 'scripts', 'browser-sync']);
gulp.task('watch', function() {
gulp.watch('assets/sass/*.scss', ['styles']);
gulp.watch('assets/js/*.js', ['scripts']);
});