The SVGs provided in example_of_generated_icons/lib/icons/utils/icons.json/
are mostly zondicons. Here you find an overview about all zondicons. They are provided under MIT license.
Take a look at the script iconGen.py
above. With this, you can create Svelte components out of .svg
files.
python iconGen.py <svg directory> <destination directory> <"append" (optional)>
Example for creating a whole new directory of icon components:
python iconGen.py "C:\Downloads\icons" "C:\Users\UserName\Documents\rezepte\src"
Example for inserting additional icons into an existing directory:
python iconGen.py "C:\Downloads\zusatz-icons" "C:\Users\UserName\Documents\rezepte\src" "append"
The destination path will normally be the src
directory of your Svelte project. This creates the following structure:
lib
|---components //contains Svelte components
|---utils
|---Icon.svelte
|---icons.json
The Svelte components in lib/icons/components
are wrappers for lib/icons/utils/Icon.svelte
. The component Icon.svelte
displays all icons provided in lib/icons/util/icons.json
. The main advantage of this approach is the flexibililty: all changes in Icon.svelte
are affecting the wrapper components without building them again.
In lib/icons/components
the generated icon components are found. All js imports are realised with the alias variable $lib
. If this alias is not already established in your project, you can add it by editing your svelte.config.js
as follows:
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://github.com/sveltejs/svelte-preprocess
// for more information about preprocessors
preprocess: preprocess(
{
postcss: true,
}
),
kit: {
adapter: adapter(),
//###############################
//this block needs to be inserted
alias: {
'$lib': 'src/lib',
'$lib/*': 'src/lib/*'
}
//###############################
}
};
export default config;
<AddOutline
size=2
direction=45
className="my-css-class"
color=blue
hover=green
rotationSpeed=10
backgroundColor=grey
/>
This code is provided under MIT license.