forked from Threespot/frontline-sass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
60 lines (51 loc) · 2.06 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
/* jshint node: true */
'use strict';
// -----------------------------------------------------------------------------
// Dependencies
// -----------------------------------------------------------------------------
const fs = require('fs');
const gulp = require('gulp');
const cssimport = require('gulp-cssimport');
const plugins = require('gulp-load-plugins')();
const packageInfo = require('./package.json');
const sass = require('gulp-sass')(require('sass'));
const sassdoc = require('sassdoc');
const path = require('path');
const yaml = require('js-yaml');
// -----------------------------------------------------------------------------
// Dist
// -----------------------------------------------------------------------------
gulp.task('build', function () {
return gulp
.src('src/_frontline.scss')
.pipe( cssimport() )
.pipe(plugins.header(fs.readFileSync('./banner.txt', 'utf8')))
.pipe(plugins.header('@charset \'UTF-8\';\n\n'))
.pipe(plugins.replace(/@version@/, packageInfo.version))
.pipe(gulp.dest('dist/'));
});
// -----------------------------------------------------------------------------
// Tests
// -----------------------------------------------------------------------------
gulp.task('test', function () {
return gulp
.src(['./tests/tests.scss'])
.pipe( sass().on('error', sass.logError) );
});
// -----------------------------------------------------------------------------
// Generate documentation site using http://sassdoc.com
// -----------------------------------------------------------------------------
gulp.task('sassdoc', function () {
var options = yaml.load(fs.readFileSync('.sassdocrc', 'utf-8'));
options.dest = './sassdoc/documentation';
options.verbose = true;
options.package = require('./package.json');
return gulp
.src('src/**/*.scss')
.pipe(sassdoc(options))
.resume();
});
// -----------------------------------------------------------------------------
// Default task
// -----------------------------------------------------------------------------
gulp.task('default', gulp.series('build'));