Skip to content

Commit

Permalink
The one with multiple configs and linters
Browse files Browse the repository at this point in the history
  • Loading branch information
AlemTuzlak committed Aug 8, 2024
1 parent 6a326e6 commit 55810ea
Show file tree
Hide file tree
Showing 14 changed files with 401 additions and 76 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export default {
fileName: "icon.svg",
// The cwd, defaults to process.cwd()
cwd: process.cwd(),
// What formatter to use to format the generated files, prettier or biome, defaults to no formatter
formatter: "biome",
// The path to the formatter config file, defaults to no path
pathToFormatterConfig: "./biome.json",
// Callback function that is called when the script is generating the icon name
// This is useful if you want to modify the icon name before it is written to the file
iconNameTransformer: (iconName) => iconName
Expand All @@ -47,6 +51,34 @@ export default {
};
```

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).
```javascript
// vite.config.js
import { iconsSpritesheet } from 'vite-plugin-icons-spritesheet';

export default {
plugins: [
iconsSpritesheet([
{
withTypes: true,
inputDir: "icons/subset1",
outputDir: "public/icons1",
typesOutputFile: "app/icons1.ts",
fileName: "icon1.svg",
},
{
withTypes: true,
inputDir: "icons/subset2",
outputDir: "public/icons2",
typesOutputFile: "app/icons2.ts",
fileName: "icon2.svg",
},
]),
],
};
```


Example component file:

```jsx
Expand Down
63 changes: 53 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 17 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vite-plugin-icons-spritesheet",
"version": "2.0.0",
"description": "Vite plugin that generates a spritesheet out of your icons.",
"version": "2.1.0",
"description": "Vite plugin that generates a spritesheet and types out of your icons folder.",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.mts",
Expand All @@ -10,7 +10,12 @@
"spritesheet",
"vite",
"plugin",
"generator"
"generator",
"react",
"angular",
"vue",
"nextjs",
"remix"
],
"exports": {
".": {
Expand Down Expand Up @@ -63,9 +68,12 @@
],
"homepage": "https://github.com/forge42dev/vite-plugin-icons-spritesheet#readme",
"dependencies": {
"@biomejs/js-api": "^0.6.2",
"@biomejs/wasm-nodejs": "^1.8.3",
"chalk": "^4.1.2",
"glob": "^10.3.12",
"node-html-parser": "^6.1.13"
"node-html-parser": "^6.1.13",
"prettier": "^3.3.3"
},
"peerDependencies": {
"vite": ">=5.2.0"
Expand All @@ -77,12 +85,12 @@
"@vitest/coverage-v8": "^1.5.2",
"eslint": "8.56",
"eslint-plugin-unused-imports": "^3.1.0",
"happy-dom": "^14.7.1",
"husky": "^9.0.11",
"npm-run-all": "^4.1.5",
"tsup": "^8.0.2",
"typescript": "^5.4.5",
"happy-dom": "^14.7.1",
"husky": "^9.0.11",
"vitest": "^1.5.2",
"vite": "5.2.11"
"vite": "5.2.11",
"vitest": "^1.5.2"
}
}
}
Loading

0 comments on commit 55810ea

Please sign in to comment.