forked from mrmrs/colors
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
97 lines (76 loc) · 2.26 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Load plugins
var gulp = require('gulp'),
gutil = require('gulp-util'),
watch = require('gulp-watch'),
lr = require('tiny-lr'),
server = lr(),
livereload = require('gulp-livereload'),
prefix = require('gulp-autoprefixer'),
minifyCSS = require('gulp-minify-css'),
sass = require('gulp-sass'),
myth = require('gulp-myth'),
stylus = require('gulp-stylus'),
csslint = require('gulp-csslint');
// Task to minify all css files in the css directory
gulp.task('minify', function(){
gulp.src('./css/*.css')
.pipe(minifyCSS({keepSpecialComments: 0}))
.pipe(gulp.dest('./css/'));
});
// Use csslint without box-sizing or compatible vendor prefixes (these
// don't seem to be kept up to date on what to yell about)
gulp.task('lint', function(){
gulp.src('./css/*.css')
.pipe(csslint({
'compatible-vendor-prefixes': false,
'box-sizing': false
}))
.pipe(csslint.reporter());
});
// Task that compiles scss files down to good old css
gulp.task('sass', function(){
gulp.src('./sass/*.scss')
.pipe(watch(function(files) {
return files.pipe(sass({includePaths: ['./sass/']}))
.pipe(prefix())
.pipe(gulp.dest('./css/'))
.pipe(livereload(server));
}));
});
// Task that compiles css using the myth processor
gulp.task('myth', function(){
gulp.src('./myth/*.css')
.pipe(myth())
.pipe(prefix())
.pipe(gulp.dest('./css/'));
});
// Just runs autoprefixer on the compiled css
gulp.task('prefix', function(){
gulp.src('./css/*.css')
.pipe(prefix())
.pipe(gulp.dest('./css/'));
});
gulp.task('stylus', function(){
gulp.src('./stylus/colors.styl')
.pipe(watch(function(files) {
return files.pipe(stylus())
.pipe(prefix())
.pipe(gulp.dest('./css/'))
.pipe(livereload(server));
}));
});
/*
DEFAULT TASK
• Process sass and lints outputted css
• Outputted css is run through autoprefixer
• Runs jshint on all js files in ./js/
• Sends updates to any files in directory to browser for
automatic reloading
*/
gulp.task('default', function(){
server.listen(35729, function (err) {
gulp.watch(['./sass/*.scss'], function(event) {
gulp.run('sass', 'lint');
});
});
});