ajithranka / example-icon-spritesheets

Example code demonstrating how to create and use icon spritesheets

Home Page:https://ajithranka.com/icon-spritesheets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example code demonstrating the use of icon spritesheets in Vue.

See ajithranka/icon-spritesheets.

Developement

Command Action
npm install Install dependencies
npm run dev Starts local dev server at localhost:8080
npm run build Build your production site to ./dist/

How it works

The create-icon-spritesheet.js script reads all icon SVG files in assets/icons, converts them to symbols, and generates a spritesheet component at components/AppIconSpritesheet.vue. Each symbol gets a unique id based on the icon's file name.

The AppIcon.vue component encapsulates icon usage with the <use> element and a name prop which maps the icon name to symbol id.

Checkout the article for a details write-up.

Credits

All icons under the assets/icons are from creativecommons.org/about/downloads.

About

Example code demonstrating how to create and use icon spritesheets

https://ajithranka.com/icon-spritesheets


Languages

Language:Vue 87.5%Language:JavaScript 9.4%Language:HTML 2.0%Language:CSS 1.0%