forked from botwiki/botwiki.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·66 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
var gulp = require('gulp'),
less = require('gulp-less'),
path = require('path'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
browserSync = require('browser-sync'),
reload = browserSync.reload,
sourcemaps = require('gulp-sourcemaps');
gulp.task('browser-sync', function () {
var files = [
'themes/botwiki/css/*.css',
'themes/botwiki/js/*.js'
];
browserSync.init(files, {
proxy: "localhost:5000"
});
});
gulp.task('styles', function() {
return gulp.src('src/styles/*.less')
.pipe(less({
paths: [ path.join(__dirname, 'less', 'includes') ]
}))
.pipe(autoprefixer('last 3 version', 'android >= 3', { cascade: true }))
.pipe(gulp.dest('themes/botwiki/css'))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest('themes/botwiki/css'))
.pipe(notify({ message: 'Styles task complete' }))
.pipe(reload({stream:true}));
});
gulp.task('scripts', function() {
return gulp.src('src/scripts/*.js')
.pipe(jshint('tests/.jshintrc'))
.pipe(jshint.reporter('default'))
.pipe(gulp.dest('themes/botwiki/js'))
.pipe(rename({suffix: '.min'}))
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(sourcemaps.write())
.pipe(gulp.dest('themes/botwiki/js'))
.pipe(notify({ message: 'Scripts task complete' }));
});
gulp.task('clean', function() {
return gulp.src(['themes/botwiki/css', 'themes/botwiki/js'], {read: false})
.pipe(clean());
});
gulp.task('watch', function() {
gulp.watch('src/styles/*.less', ['styles']);
gulp.watch('src/scripts/*.js', ['scripts']);
});
gulp.task('default', ['clean'], function() {
gulp.start('styles', 'scripts', 'browser-sync', 'watch');
});