Export your sketch layer with data URI for code usage
Usage
- Choose the layer you want to export
- Use shortcut
command(⌘) + `
to export your code immediately
Feature
- Support PNG and SVG image type, export PNG file by encoding it with base64 format while using encoded xml when export SVG file.(See this article Probably Don’t Base64 SVG )
- Provide multiple templates for different usage, including code in html(innerHtml), css background and css mask.
- Auto save your last copy preference
- Compress PNG file with advpng
- Compress SVG file widh svgo
Installation
- Download the latest release of the plugin
- Un-zip
- Double-click on imagecodeexporter.sketchplugin
Acknowledgements
Thanks to these project to give me some ideas about how to make this plugin
- svgo-compressor sketch plugin of compressing svg while export svg file
- sketch-image-compressor sketch plugin of compressing image
Development Guide
This plugin was created using skpm
. For a detailed explanation on how things work, checkout the skpm Readme.
Usage
Install the dependencies
npm install
Once the installation is done, you can run some commands inside the project folder:
npm run build
To watch for changes:
npm run watch