-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
35 lines (29 loc) · 990 Bytes
/
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
'use strict';
const path = require('path');
const gulp = require('gulp');
const gutil = require('gulp-util');
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('/'));
gulp.task('copy-uswds-assets', () => {
return gulp.src(`${USWDS_DIST}/@(js|fonts|img)/**/**`)
.pipe(gulp.dest('./assets/vendor/uswds'));
});
gulp.task('sass', () => {
return gulp.src('./assets/sass/**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({
includePaths: [
path.join(USWDS_DIST_DIR, 'scss'),
]
}).on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./assets/css'));
});
gulp.task('watch', ['default'], () => {
gulp.watch('./assets/sass/**/*.scss', ['sass']);
});
gulp.task('default', ['sass', 'copy-uswds-assets']);