Skip to content

Commit

Permalink
chore: use vite's emitFile (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcansh authored Apr 10, 2024
1 parent 96f9c1b commit 9507fa9
Show file tree
Hide file tree
Showing 25 changed files with 234 additions and 134 deletions.
9 changes: 9 additions & 0 deletions .changeset/itchy-trainers-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@mcansh/vite-svg-sprite-plugin": minor
---

use vite's emitFile to emit consistent file to all builds

do some post build file transforms to replace the dev sprite name with the actual hashed sprite filename

sort icons before adding to sprite for consistent hashes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import archiveBoxArrowDownIconHref from "~/assets/archive-box-arrow-down.svg";
import beakerIconHref from "heroicons/24/outline/beaker.svg";
import eyeIconHref from "lucide-static/icons/eye.svg";
import homeIconHref from "lucide-static/icons/home.svg";
import spriteUrl from "virtual:vite-svg-sprite-plugin";
import { Icon } from "./icon";

export const meta: MetaFunction = () => {
Expand All @@ -18,7 +17,6 @@ export default function Index() {
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.8" }}>
<h1>Welcome to Remix</h1>

<p>{spriteUrl}</p>
<Icon icon={archiveBoxArrowDownIconHref} width={100} height={100} />
<Icon icon={beakerIconHref} width={100} height={100} />
<Icon icon={eyeIconHref} width={100} height={100} />
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export default defineConfig({
remix(),
tsconfigPaths(),
createSvgSpritePlugin({
spriteOutputName: "sprite.svg",
logging: true,
spriteOutputName: "some-file.svg",
}),
],
});
Loading

0 comments on commit 9507fa9

Please sign in to comment.