forked from 18F/culper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
107 lines (98 loc) · 2.31 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
var webpack = require('webpack-stream')
var del = require('del')
var gulp = require('gulp')
var concat = require('gulp-concat')
var sass = require('gulp-sass')
var sasslint = require('@18f/stylelint-rules')
require('dotenv').config()
var paths = {
entry: './src/boot.jsx',
js: [
'./src/**/*.js*'
],
sassvars: './src/sass',
sass: {
rules: {
config: '../../../stylelint.config.js'
},
vars: './src/sass',
local: [
'./src/**/*.s+(a|c)ss'
],
global: [
'./node_modules/font-awesome/**/*.s+(a|c)ss',
'./node_modules/uswds/src/stylesheets/**/*.s+(a|c)ss'
]
},
html: ['./src/**/*.html'],
fonts: [
'./node_modules/font-awesome/fonts/**/*',
'./node_modules/uswds/dist/fonts/**/*'
],
images: [
'./node_modules/uswds/dist/img/**/*',
'./src/img/*'
],
css: 'eqip.css',
destination: {
root: './dist',
css: './dist/css',
fonts: './dist/fonts',
images: './dist/img'
},
webpack: './webpack.config.js'
}
gulp.task('clean', clean)
gulp.task('copy', ['clean'], copy)
gulp.task('fonts', ['clean'], fonts)
gulp.task('images', ['clean'], images)
gulp.task('lint', [], sasslint(paths.sass.local[0], paths.sass.rules))
gulp.task('sass', ['clean'], convert)
gulp.task('build', ['clean', 'copy', 'fonts', 'images', 'sass'], compile)
gulp.task('watchdog', ['build'], watchdog)
gulp.task('default', ['build'])
function clean () {
'use strict'
return del([
paths.destination.root + '/*'
])
}
function copy () {
'use strict'
return gulp
.src(paths.html)
.pipe(gulp.dest(paths.destination.root))
}
function fonts () {
'use strict'
return gulp
.src(paths.fonts)
.pipe(gulp.dest(paths.destination.fonts))
}
function images () {
'use strict'
return gulp
.src(paths.images)
.pipe(gulp.dest(paths.destination.images))
}
function compile () {
'use strict'
return gulp
.src(paths.entry)
.pipe(webpack(require(paths.webpack)))
.pipe(gulp.dest(paths.destination.root))
}
function convert () {
'use strict'
return gulp
.src(paths.sass.global.concat(paths.sass.local))
.pipe(sass({
includePaths: [ paths.sass.vars ]
}))
.pipe(concat(paths.css))
.pipe(gulp.dest(paths.destination.css))
}
function watchdog () {
'use strict'
return gulp.watch([paths.js, paths.sass.local], ['build'])
}