-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
127 lines (109 loc) · 3.16 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// Include Gulp
var gulp = require('gulp');
// Include Plugins
var jshint = require('gulp-jshint');
var coffee = require('gulp-coffee');
var uglify = require('gulp-uglify');
var less = require('gulp-less');
var sass = require('gulp-sass');
var stylus = require('gulp-stylus');
var haml = require('gulp-ruby-haml');
var jade = require('gulp-jade');
var htmlmin = require('gulp-htmlmin');
var imagemin = require('gulp-imagemin');
var pngquant = require('imagemin-pngquant');
var path = require('path');
// JS Lint Task
gulp.task('lint', function() {
return gulp.src('src/js/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
// Coffee JS
gulp.task('coffee', function() {
return gulp.src('src/coffee/**/*.coffee')
.pipe(coffee({bare:true}))
.pipe(gulp.dest('dist/js'))
});
// Uglify - Minify Files
gulp.task('compress', function() {
return gulp.src('src/js/*.js')
.pipe(uglify())
.pipe(gulp.dest('dist/js'));
});
// LESS
gulp.task('less', function() {
return gulp.src([
'src/less/bookcase.less',
'src/less/helpers.less'
])
.pipe(less({
paths: ['src/less']
}))
.pipe(gulp.dest('dist/css'));
});
// SASS
gulp.task('sass', function() {
return gulp.src('src/scss/*.scss')
.pipe(sass.sync().on('error', sass.logError))
.pipe(gulp.dest('dist/css'));
});
// Stylus
gulp.task('one', function() {
return gulp.src([
'src/styl/bookcase.styl',
'src/styl/helpers.styl'
])
.pipe(stylus())
.pipe(gulp.dest('dist/css'));
});
// HTML
gulp.task('minify', function() {
gulp.src('src/*.html')
.pipe(htmlmin())
.pipe(gulp.dest('dist'));
});
// HAML
gulp.task('haml', function() {
gulp.src('src/*.haml')
.pipe(haml())
.pipe(gulp.dest('dist'));
});
// Jade
gulp.task('templates', function() {
gulp.src('src/*.jade')
.pipe(jade({
pretty: true
}))
.pipe(gulp.dest('dist'));
});
// Imagemin
gulp.task('imagemin', function() {
return gulp.src('src/img/**/*')
.pipe(imagemin( {
progressive: true,
use: [pngquant()]
}))
.pipe(gulp.dest('dist/img'))
});
// Watch
/*
The default for Bookcase is to look for HTML, JADE and Javascript changes. Instructions for making use of CSS Processors or
HTML Template Languages is below:
-- CSS Preprocessors
LESS: To use LESS make 'less' the file location, and the file type .less. Make the tasks 'less'.
SASS: To use SASS make 'scss' the file location, and the file type .scss. Make the tasks 'sass'.
STYLUS: To use STYLUS make 'styl' the file location, and the file type .styl. Make the tasks 'one'.
-- HTML Template Languages
HTML: To use HTML the file type .html. Make the tasks 'minify'
HAML: To use HAML the file type .haml. Make the tasks 'haml'.
JADE: To use JADE the file type .jade. Make the tasks 'templates'.
*/
gulp.task('watch', function() {
gulp.watch('src/js/**/*.js', ['lint']);
gulp.watch('src/coffee/**/*.coffee', ['coffee']);
gulp.watch('src/**/*.html', ['minify']);
gulp.watch('src/less/**/*.less', ['less']);
});
// Default Task
gulp.task('default', ['lint', 'coffee', 'minify', 'less', 'imagemin', 'watch']);