-
Notifications
You must be signed in to change notification settings - Fork 5
/
gulpfile.js
69 lines (61 loc) · 1.8 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
// Requires
var gulp = require('gulp');
// Include plugins
var less = require('gulp-less');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var minify = require('gulp-minify-css');
var sourcemaps = require('gulp-sourcemaps');
var rename = require('gulp-rename');
var browserSync = require('browser-sync');
// var styledown = require('gulp-styledown');
// Common tasks
gulp.task('styles', ['styles-less', 'styles-sass']);
gulp.task('doallthethings', ['styles','scripts']);
// Styles LESS
gulp.task('styles-less', function () {
return gulp.src('assets/css/*.less')
.pipe(less())
.pipe(minify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('assets/css/'));
});
// Styles SASS
gulp.task('styles-sass', function () {
gulp.src('./assets/css/*.scss')
.pipe(sass())
.pipe(sourcemaps.init())
.pipe(minify({keepBreaks:false,keepSpecialComments:0}))
.pipe(sourcemaps.write())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./assets/css/'));
});
// Scripts
gulp.task('scripts',function() {
return gulp.src('assets/js/src/*.js')
.pipe(uglify())
.pipe(concat('global.min.js'))
.pipe(gulp.dest('assets/js/'));
});
/*
// Styledown (styleguide)
gulp.task('styleguide', function() {
gulp.src('assets/css/*.less')
.pipe(styledown({
config: 'assets/css/config.md',
filename: 'styleguide.html'
}))
.pipe(gulp.dest('.'));
});
*/
// Watcher
gulp.task('watch', function() {
browserSync({
proxy: 'http://localhost:5000'
});
gulp.watch(['./assets/css/*.scss'], ['styles-sass', browserSync.reload /*,'styleguide'*/ ]);
gulp.watch(['./assets/css/*.less'], ['styles-less', browserSync.reload /*,'styleguide'*/ ]);
gulp.watch(['./assets/js/src/*.js'], ['scripts']);
});
gulp.task('default', ['doallthethings']);