An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# purescript-svg-parser-smolder


purescript-svg-parser-smolder on Pursuit

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"
```