-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
69 lines (63 loc) · 1.68 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'),
sass = require('gulp-sass'),
minifyCss = require('gulp-minify-css'),
rename = require('gulp-rename'),
styleguide = require('sc5-styleguide');
var styleguidePath = 'styleguide';
/*
* styles
* compiles our scss files in the src directory and outputs both minified
* and unminified versions to the dist directory
*/
gulp.task('styles', function() {
gulp.src('./src/**/*.scss')
.pipe(sass({
includePaths: [].concat(
require('node-normalize-scss').includePaths,
require('node-reset-scss').includePath
)
}).on('error', sass.logError))
.pipe(gulp.dest('./dist'))
.pipe(rename({suffix: '.min'}))
.pipe(minifyCss())
.pipe(gulp.dest('./dist'));
});
/*
* styles:watch
* watch for any changes in our scss files and trigger the styles task
*/
gulp.task('styles:watch', function() {
gulp.watch('./src/**/*.scss', ['styles']);
});
/*
* styleguide:generate
*/
gulp.task('styleguide:generate', function() {
return gulp.src('./src/**/*.scss')
.pipe(styleguide.generate({
title: 'Styleguide',
server: true,
rootPath: styleguidePath,
overviewPath: 'README.md'
}))
.pipe(gulp.dest(styleguidePath));
});
/*
* styleguide:applystyles
*/
gulp.task('styleguide:applystyles', function() {
return gulp.src('./src/main.scss')
.pipe(sass({
errLogToConsole: true,
includePaths: [].concat(
require('node-normalize-scss').includePaths,
require('node-reset-scss').includePath
)
}))
.pipe(styleguide.applyStyles())
.pipe(gulp.dest(styleguidePath));
});
/*
* styleguide
*/
gulp.task('styleguide', ['styleguide:generate', 'styleguide:applystyles']);