-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
104 lines (74 loc) · 2.21 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
/*
A Gulp build of USWDS
*/
const autoprefixer = require("autoprefixer");
const csso = require("postcss-csso");
const gulp = require("gulp");
const pkg = require("./node_modules/@uswds/uswds/package.json");
const postcss = require("gulp-postcss");
const replace = require("gulp-replace");
const sass = require("gulp-sass")(require("sass"));
const sourcemaps = require("gulp-sourcemaps");
const del = require("del");
const svgSprite = require("gulp-svg-sprite");
const rename = require("gulp-rename");
const browserSync = require("browser-sync").create();
const uswds = require("@uswds/compile");
/*
----------------------------------------
USWDS setings and global constants
----------------------------------------
*/
uswds.settings.version = 3;
// They call this a *dist*, but it is the source of *my* USWDS theming SCSS
uswds.paths.dist.theme = "./src/sass";
// CSS Destination
uswds.paths.dist.css = "./dist/css";
// Images destination
uswds.paths.dist.img = "./dist/img";
// Fonts destination
uswds.paths.dist.fonts = "./dist/fonts";
// Javascript destination
uswds.paths.dist.js = "./dist/js";
// Extra Images source location
const PROJECT_IMG_SRC = "./src/img";
/*
----------------------------------------
TASKS
----------------------------------------
*/
exports.copyFonts = uswds.copyFonts;
exports.copyImages = uswds.copyImages;
gulp.task("copyNLMImages", () => {
return gulp.src(`${PROJECT_IMG_SRC}/**/**`).pipe(gulp.dest(uswds.paths.dist.img));
});
exports.copyJS = uswds.copyJS;
exports.copyAssets = uswds.copyAssets;
exports.copyAll = uswds.copyAll;
exports.compileSass = uswds.compileSass;
exports.compileIcons = uswds.compileIcons;
exports.build = uswds.updateUswds;
exports.compile = uswds.compile;
exports.watch = uswds.watch;
exports.defaults = uswds.watch;
function clean(cb) {
cb();
return del.sync("dist");
}
exports.clean = clean;
function initServe(cb) {
browserSync.init({
"server": {
"baseDir": ["./examples", "./dist"],
"index": "index.htm"
},
"files": [
"./dist/css/nlm-uswds.css",
"./examples/basic.htm",
"./examples/alla.htm",
"./examples/index.htm"
]
});
cb();
}
exports.serve = gulp.series(uswds.updateUswds, initServe, uswds.watch);