Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USWDS-Compile - Dependencies: GulpJS v5 #96

Merged
merged 5 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,18 @@ const copy = {
colors.blue,
`Copy USWDS fonts: ${getSrcFrom("fonts")} → ${paths.dist.fonts}`
);
return src(`${getSrcFrom("fonts")}/**/**`.replace("//", "/")).pipe(
dest(paths.dist.fonts)
);
return src(`${getSrcFrom("fonts")}/**/**`.replace("//", "/"), {
encoding: false,
}).pipe(dest(paths.dist.fonts));
Comment on lines +114 to +116
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoids corruption on images and fonts.

More info here: gulpjs/gulp#2803

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! And thanks for the reference link 👏

},
images() {
log(
colors.blue,
`Copy USWDS images: ${getSrcFrom("img")} → ${paths.dist.img}`
);
return src(`${getSrcFrom("img")}/**/**`.replace("//", "/")).pipe(
return src(`${getSrcFrom("img")}/**/**`.replace("//", "/"), {
encoding: false,
}).pipe(
dest(paths.dist.img)
);
},
Expand Down Expand Up @@ -156,7 +158,10 @@ function getUswdsVersion() {
if (settings.version === 3) {
uswdsPackage = "@uswds/uswds";
}
const packagePath = path.join(path.dirname(require.resolve(uswdsPackage)), '../../');
const packagePath = path.join(
path.dirname(require.resolve(uswdsPackage)),
"../../"
);
const version = require(`${packagePath}/package.json`).version;
return version;
}
Expand Down Expand Up @@ -245,6 +250,7 @@ function buildSprite() {

return src(spritePaths, {
allowEmpty: true,
encoding: false
})
.pipe(svgSprite())
.pipe(rename("usa-icons.svg"))
Expand All @@ -255,6 +261,7 @@ function buildSprite() {
function renameSprite() {
return src(`${paths.dist.img}/usa-icons.svg`.replace("//", "/"), {
allowEmpty: true,
encoding: false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Didn't notice any difference here. Keeping because SVGs it still following recommendation for removing encoding from images.

})
.pipe(rename(`${paths.dist.img}/sprite.svg`.replace("//", "/")))
.pipe(dest(`./`));
Expand Down
Loading