-
Notifications
You must be signed in to change notification settings - Fork 27
Update to a more modern SVG sprite compiler #27
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
Conversation
Tested on an ARM64 arch |
assets/ | ||
sass/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are generated when testing, but should be ignored
@@ -6,7 +6,7 @@ const replace = require("gulp-replace"); | |||
const sass = require("gulp-sass")(require("sass-embedded")); | |||
const sourcemaps = require("gulp-sourcemaps"); | |||
const del = require("del"); | |||
const svgSprite = require("gulp-svg-sprite"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the new sprite builder
const config = { | ||
shape: { | ||
dimension: { | ||
// Set maximum dimensions | ||
maxWidth: settings.sprite.width, | ||
maxHeight: settings.sprite.width, | ||
}, | ||
id: { | ||
separator: settings.sprite.separator, | ||
}, | ||
spacing: { | ||
// Add padding | ||
padding: 0, | ||
}, | ||
}, | ||
mode: { | ||
symbol: true, // Activate the «symbol» mode | ||
}, | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This config does not apply to the new package. As far as I can tell, this is not necessary as long as we continue to use 24x24 SVGs with height
, width
, and viewBox
set properly.
.on("error", handleError) | ||
.pipe(dest(`${paths.dist.img}`)); | ||
} | ||
|
||
function renameSprite() { | ||
return src(`${paths.dist.img}/symbol/svg/sprite.symbol.svg`.replaceAll("//", "/"), { | ||
return src(`${paths.dist.img}/usa-icons.svg`.replaceAll("//", "/"), { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Point to the new outputted file
"postcss": "^8.4.8", | ||
"postcss-csso": "^5.0.1", | ||
"sass-embedded": "^1.49.9" | ||
"autoprefixer": "10.4.7", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update autoprefixer
"gulp-postcss": "9.0.1", | ||
"gulp-rename": "2.0.0", | ||
"gulp-replace": "1.1.3", | ||
"gulp-sass": "5.1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update gulp-sass
"gulp-svgstore": "9.0.0", | ||
"postcss": "8.4.8", | ||
"postcss-csso": "5.0.1", | ||
"sass-embedded": "1.50.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update sass-embedded
"devDependencies": { | ||
"@uswds/uswds": "^3.0.0", | ||
"uswds": "^2.13.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using USWDS 2.x and 3.x here are testing dependencies
Well done. Thank you! 👏 🙌 |
Updating to
gulp-svgstore
. Notes in the comments