-
Notifications
You must be signed in to change notification settings - Fork 87
/
gulpfile.js
46 lines (34 loc) · 1.23 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
'use strict';
const path = require('path');
const gulp = require('gulp');
const sass = require('gulp-sass');
const sourcemaps = require('gulp-sourcemaps');
const exec = require('child_process').exec;
const PORT = process.env.PORT || '8000';
const USWDS_DIST = 'node_modules/uswds/dist';
const USWDS_DIST_DIR = path.join(__dirname, ...USWDS_DIST.split('/'));
const PROJECT_SASS_SRC = "./assets/sass/**/*.scss";
const PROJECT_CSS_DEST = './assets/css'
const PROJECT_ASSETS_SRC = `${USWDS_DIST}/@(js|fonts|img)/**/**`
const PROJECT_ASSETS_DEST = './assets/vendor/uswds'
gulp.task('copy-uswds-assets', () => {
return gulp.src(PROJECT_ASSETS_SRC)
.pipe(gulp.dest(PROJECT_ASSETS_DEST));
});
gulp.task('build-sass', () => {
return gulp.src(PROJECT_SASS_SRC)
.pipe(sourcemaps.init())
.pipe(sass({
includePaths: [
path.join(USWDS_DIST_DIR, 'scss'),
]
}).on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(gulp.dest(PROJECT_CSS_DEST));
});
/** entry points **/
// gulp.task('init', gulp.series('copy-uswds-assets'));
gulp.task('watch', () => {
gulp.watch(PROJECT_SASS_SRC, gulp.series('copy-uswds-assets','build-sass'));
});
gulp.task('default', gulp.series('copy-uswds-assets', 'build-sass'));