Skip to content

Commit 55810ea

Browse files
committed
The one with multiple configs and linters
1 parent 6a326e6 commit 55810ea

14 files changed

Lines changed: 401 additions & 76 deletions

File tree

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ export default {
3939
fileName: "icon.svg",
4040
// The cwd, defaults to process.cwd()
4141
cwd: process.cwd(),
42+
// What formatter to use to format the generated files, prettier or biome, defaults to no formatter
43+
formatter: "biome",
44+
// The path to the formatter config file, defaults to no path
45+
pathToFormatterConfig: "./biome.json",
4246
// Callback function that is called when the script is generating the icon name
4347
// This is useful if you want to modify the icon name before it is written to the file
4448
iconNameTransformer: (iconName) => iconName
@@ -47,6 +51,34 @@ export default {
4751
};
4852
```
4953

54+
You can also pass an array of configs to the plugin to generate multiple spritesheets and types files at the same time (and watch those folders for changes).
55+
```javascript
56+
// vite.config.js
57+
import { iconsSpritesheet } from 'vite-plugin-icons-spritesheet';
58+
59+
export default {
60+
plugins: [
61+
iconsSpritesheet([
62+
{
63+
withTypes: true,
64+
inputDir: "icons/subset1",
65+
outputDir: "public/icons1",
66+
typesOutputFile: "app/icons1.ts",
67+
fileName: "icon1.svg",
68+
},
69+
{
70+
withTypes: true,
71+
inputDir: "icons/subset2",
72+
outputDir: "public/icons2",
73+
typesOutputFile: "app/icons2.ts",
74+
fileName: "icon2.svg",
75+
},
76+
]),
77+
],
78+
};
79+
```
80+
81+
5082
Example component file:
5183

5284
```jsx

package-lock.json

Lines changed: 53 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vite-plugin-icons-spritesheet",
3-
"version": "2.0.0",
4-
"description": "Vite plugin that generates a spritesheet out of your icons.",
3+
"version": "2.1.0",
4+
"description": "Vite plugin that generates a spritesheet and types out of your icons folder.",
55
"main": "./dist/index.js",
66
"module": "./dist/index.mjs",
77
"types": "./dist/index.d.mts",
@@ -10,7 +10,12 @@
1010
"spritesheet",
1111
"vite",
1212
"plugin",
13-
"generator"
13+
"generator",
14+
"react",
15+
"angular",
16+
"vue",
17+
"nextjs",
18+
"remix"
1419
],
1520
"exports": {
1621
".": {
@@ -63,9 +68,12 @@
6368
],
6469
"homepage": "https://github.com/forge42dev/vite-plugin-icons-spritesheet#readme",
6570
"dependencies": {
71+
"@biomejs/js-api": "^0.6.2",
72+
"@biomejs/wasm-nodejs": "^1.8.3",
6673
"chalk": "^4.1.2",
6774
"glob": "^10.3.12",
68-
"node-html-parser": "^6.1.13"
75+
"node-html-parser": "^6.1.13",
76+
"prettier": "^3.3.3"
6977
},
7078
"peerDependencies": {
7179
"vite": ">=5.2.0"
@@ -77,12 +85,12 @@
7785
"@vitest/coverage-v8": "^1.5.2",
7886
"eslint": "8.56",
7987
"eslint-plugin-unused-imports": "^3.1.0",
88+
"happy-dom": "^14.7.1",
89+
"husky": "^9.0.11",
8090
"npm-run-all": "^4.1.5",
8191
"tsup": "^8.0.2",
8292
"typescript": "^5.4.5",
83-
"happy-dom": "^14.7.1",
84-
"husky": "^9.0.11",
85-
"vitest": "^1.5.2",
86-
"vite": "5.2.11"
93+
"vite": "5.2.11",
94+
"vitest": "^1.5.2"
8795
}
88-
}
96+
}

0 commit comments

Comments
 (0)