-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
70 lines (59 loc) · 1.93 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'),
gutil = require('gulp-util'),
notify = require('gulp-notify'),
jshint = require('gulp-jshint'),
sass = require('gulp-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');
deploy = require("gulp-gh-pages");
// JS task
gulp.task('scripts', function() {
gulp.src('../tedxlausanne-styleguide/assets/js/*.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(concat('main.js'))
.pipe(gulp.dest('./static/js'))
});
// Reload all Browsers
gulp.task('bs-reload', function () {
browserSync.reload();
});
gulp.task('browser-sync', function() {
browserSync.init({
open: false,
reloadDelay: 2000,
server: {
baseDir: "./static"
}
});
});
gulp.task('deploy', function () {
gulp.src("./static/**/*")
.pipe(deploy());
});
gulp.task('build-images', function() {
return gulp.src(['../tedxlausanne-styleguide/assets/img/**'])
.pipe(gulp.dest('static/img'));
});
// SASS compile, autoprefix and minify task
gulp.task('styles', function() {
return gulp.src('../tedxlausanne-styleguide/assets/sass/style.scss')
.pipe(sass())
.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(rename('style.min.css'))
.pipe(gulp.dest('./static/css'));
});
gulp.task('watch',['styles', 'scripts'], function() {
gulp.watch("./static/**/*", ['bs-reload']);
});
gulp.task('default', ['styles', 'browser-sync', 'watch', 'scripts', 'build-images']);
gulp.task('build', ['styles', 'scripts', 'build-images']);