Skip to content

Commit

Permalink
chore: improve gulp build issues (#753)
Browse files Browse the repository at this point in the history
* chore: improve gulp build issues

* remove gulp remember
  • Loading branch information
braddialpad authored Nov 30, 2022
1 parent 473ec09 commit 6f6e4d0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 286 deletions.
21 changes: 7 additions & 14 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const del = require('del');
const rename = require('gulp-rename');
const cache = require('gulp-cached');
const concat = require('gulp-concat');
const remember = require('gulp-remember');
const through2 = require('through2');
const argv = require('yargs').argv;

Expand Down Expand Up @@ -225,7 +224,6 @@ const libStyles = function (done) {

// Compile library files
return src(paths.styles.inputLib)
// .pipe(cache('libStyles'))
.pipe(less())
.pipe(replace('../../fonts/', '../fonts/'))
.pipe(postcss([postcssResponsify, postcssFocusVisible]))
Expand All @@ -243,10 +241,10 @@ const libStylesDev = function (done) {

// Compile library files
return src(paths.styles.inputLib)
// compile less to css
// compile less to css
.pipe(less())
.pipe(postcss([postcssResponsify, postcssFocusVisible]))
// concat the css into a single file
// concat the css into a single file
.pipe(concat('dialtone.css'))
.pipe(dest(paths.styles.outputLib))
.pipe(dest(paths.styles.outputDocs));
Expand Down Expand Up @@ -424,7 +422,8 @@ const buildSpotIllustrationSVGs = function (done) {
if (!settings.spot) return done();
// Compile system icons
return src(paths.spot.input)
// replace any instances of the primary color in SVG with the theme class
.pipe(cache('buildSpotIllustrationSVGs'))
// replace any instances of the primary color in SVG with the theme class
.pipe(replace('<svg', function (match) {
const name = path.parse(this.file.path).name;
const converted = name.toLowerCase().replace(/-(.)/g, function (match, group1) {
Expand Down Expand Up @@ -605,16 +604,9 @@ const watchFiles = function (done) {
if (!settings.watch) return done();

// Watch files
const watcher = watch([
watch([
paths.watch.lib,
paths.watch.docs,
], series(exports.buildWatch));
watcher.on('change', function (event) {
if (event.type === 'deleted') { // if a file is deleted, forget about it
delete cache.caches.libStylesDev[event.path];
remember.forget('libStylesDev', event.path);
}
});
done();
};

Expand Down Expand Up @@ -647,6 +639,7 @@ const buildNewSVGIcons = function (done) {

// Compile icons
return src(paths.version7.input)
.pipe(cache('buildNewSVGIcons'))
.pipe(replace(' fill="none"', ''))
.pipe(replace(' fill="#000"', ' fill="currentColor"'))
.pipe(replace(' fill="#000000"', ' fill="currentColor"'))
Expand Down Expand Up @@ -716,7 +709,6 @@ exports.default = series(
// tasks are similar to default build when we are watching but there are some
// differences. We use caching, and do not postprocess/minify for build performance gains. Also set the env
exports.buildWatch = series(
exports.clean,
webfonts,
exports.svg,
libStylesDev,
Expand All @@ -725,6 +717,7 @@ exports.buildWatch = series(

// build and run the gulp watch.
exports.watch = series(
exports.clean,
exports.buildWatch,
parallel(
watchFiles,
Expand Down
Loading

0 comments on commit 6f6e4d0

Please sign in to comment.