Skip to content

Commit

Permalink
fix: rebase issue
Browse files Browse the repository at this point in the history
  • Loading branch information
e-krebs committed Sep 22, 2024
1 parent 120a24f commit 4350fde
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import fs from 'fs';
import { defineConfig } from 'vite';

function inlineSvg(...paths) {
return {
name: 'inline-svg',
transformIndexHtml: {
enforce: 'pre',
transform: (html) => {
if (!Array.isArray(paths) || paths.length <= 0) return html;

let newHtml = html;
paths.forEach((svg) => {
const extractedSvg = fs.readFileSync(svg, 'utf8');
newHtml = newHtml.replace('<body>', `<body>${extractedSvg}`);
});
return newHtml;
},
},
};
}
export default defineConfig({
server: { open: false },
plugins: [inlineSvg('src/assets/icons.svg', '.ladle/assets/stories-icons.svg')],
});

0 comments on commit 4350fde

Please sign in to comment.