-
Notifications
You must be signed in to change notification settings - Fork 167
/
demo-gulpfile.js
58 lines (53 loc) · 1.83 KB
/
demo-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
var gulp = require('gulp'),
styleguide = require('./lib/styleguide'),
postcss = require('gulp-postcss'),
rename = require('gulp-rename'),
source = 'lib/app/css/*.css',
outputPath = 'demo-output';
gulp.task('styleguide:generate', function() {
return gulp.src(source)
.pipe(styleguide.generate({
title: 'SC5 Styleguide',
server: true,
rootPath: outputPath,
overviewPath: 'README.md',
styleVariables: 'lib/app/css/_styleguide_variables.css',
parsers: {
css: 'postcss'
},
styleguideProcessors: {
40: function(styleguide) {
styleguide.sections[0].description = styleguide.sections[0].description + ' [Description from custom Processor]';
}
}
}))
.pipe(gulp.dest(outputPath));
});
gulp.task('styleguide:applystyles', function() {
return gulp.src('lib/app/css/styleguide-app.css')
.pipe(postcss([
require('postcss-partial-import'),
require('postcss-mixins'),
require('gulp-cssnext'),
require('postcss-advanced-variables'),
require('postcss-conditionals'),
require('postcss-color-function'),
require('postcss-color-alpha'),
require('postcss-nested'),
require('postcss-custom-media'),
require('autoprefixer'),
require('postcss-inline-comment')
]))
.pipe(rename('styleguide-app.css'))
.pipe(styleguide.applyStyles())
.pipe(gulp.dest(outputPath));
});
gulp.task('styleguide', ['styleguide:static', 'styleguide:generate', 'styleguide:applystyles']);
gulp.task('styleguide:static', function() {
gulp.src(['lib/demo/**'])
.pipe(gulp.dest(outputPath + '/demo'));
});
gulp.task('watch', ['styleguide'], function() {
// Start watching changes and update styleguide whenever changes are detected
gulp.watch(source, ['styleguide']);
});