This repository was archived by the owner on Mar 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgulpfile.js
More file actions
95 lines (79 loc) · 2.11 KB
/
gulpfile.js
File metadata and controls
95 lines (79 loc) · 2.11 KB
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
/*jshint node:true,strict:true,undef:true,unused:true*/
'use strict';
/**
* Import tasks
**/
var plumber = require('gulp-plumber');
var bump = require('gulp-bump');
var del = require('del');
var sass = require('gulp-sass');
var sassdoc = require('sassdoc');
var gutil = require('gulp-util');
var gulp = require('gulp');
/**
* Environment
**/
// Determine whether running in production or not: If NODE_ENV=production or invoking gulp with --production argument.
var isProduction = process.env.NODE_ENV === 'production' || !!gutil.env.production;
// Style path
var styleExamples = './examples/**/*.scss';
var styleMain = './src/njord.scss';
var styleFiles = './src/**/*.scss';
/**
* Tasks
*/
// Cleans the destination build folder: gulp clean
gulp.task('clean', function(cb) {
del('*.css', cb);
});
// Compile Compass stylesheets to CSS.
gulp.task('examples', function() {
gulp.src(styleExamples)
.pipe(plumber())
.pipe(sass({
precision: 10,
outputStyle: isProduction ? 'compressed' : 'expanded',
errLogToConsole: true
}))
.pipe(gulp.dest('./examples'));
});
// Compile Compass stylesheets to CSS.
gulp.task('style', function() {
gulp.src(styleMain)
.pipe(plumber())
.pipe(sass({
precision: 10,
outputStyle: isProduction ? 'compressed' : 'expanded',
errLogToConsole: true
}))
.pipe(gulp.dest('./'));
});
// Versioning
gulp.task('bump', function() {
gulp.src(['package.json'], {
base: './'
})
.pipe(bump({
type: gutil.env.bump ? gutil.env.bump : 'patch'
}))
.pipe(gulp.dest('./'));
});
// Watch for file changes and build accordingly.
gulp.task('watch', function() {
gulp.watch(styleFiles, ['style']);
gulp.watch([styleFiles, styleExamples], ['examples']);
});
// Documentation
gulp.task('sassdoc', function () {
return gulp.src(styleFiles)
.pipe(sassdoc({
dest: './docs',
descriptionPath: './readme.md',
groups: require('./sassdoc-groups')
}));
});
// Default tasks.
// In NPM it is setup with: gulp clean && gulp build --production
gulp.task('build', ['style']);
// When developing you can continuously build files using just: gulp
gulp.task('default', ['build', 'watch']);