Skip to content

Suggestion: mount optimized icons #5

Description

@rhcarvalho

I was looking at what gets published to NPM, and seems that their build script takes input from src and output to optimize, then copying the result to top-level directories and releasing that.

https://github.com/tailwindlabs/heroicons/blob/eee05eb77af6cdedfb97f128d1998773fc984b28/package.json#L17-L19

In my project I changed the mount point to use the optimized version of the icons:

  [[module.imports]]
    path="github.com/tailwindlabs/heroicons"
  [[module.imports.mounts]]
    source = "optimized"
    target = "assets/svg/heroicons"

Among other benefits, this allows for easier control of icon size using CSS. Example:

{{ $icon := resources.Get "svg/heroicons/20/solid/phone.svg" }}
<span class="w-8 h-auto">{{ $icon.Content | safeHTML }}</span>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions