https://github.com/rnons/purescript-svg-parser-smolder
A library to inline SVG string into smolder views
https://github.com/rnons/purescript-svg-parser-smolder
Last synced: 5 months ago
JSON representation
A library to inline SVG string into smolder views
- Host: GitHub
- URL: https://github.com/rnons/purescript-svg-parser-smolder
- Owner: rnons
- License: bsd-3-clause
- Created: 2018-10-12T10:15:00.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-12T10:17:24.000Z (over 7 years ago)
- Last Synced: 2025-09-01T04:38:56.719Z (10 months ago)
- Language: PureScript
- Homepage: https://rnons.github.io/purescript-svg-parser-smolder
- Size: 261 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# purescript-svg-parser-smolder
A library to inline SVG string into smolder views.
See [Demo](https://rnons.github.io/purescript-svg-parser-smolder) for an example.
## How to use
```purescript
import Svg.Renderer.Smolder (icon)
-- | You can use FFI and webpack raw-loader to load external SVG files
code :: String
code = """"""
type Icon = forall e. HTML e
iconCode :: Icon
iconCode = icon code
```
It's as simple as this, in most cases you only need the `icon` function. You can then use `iconCode` in your view, you can also apply additional className to it.
```purescript
import Text.Smolder.HTML.Attributes as HA
import Text.Smolder.Markup ((!))
view =
iconCode ! HA.className "icon"
```