Giter Site home page Giter Site logo

hugo-mod-heroicons's People

Contributors

bep avatar foo-dogsquared avatar jygastaud avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hugo-mod-heroicons's Issues

Is this functional?

I added the bare bones to config, trying to get this to work:

[[module]]
[[module.imports]]
path = "github.com/gohugoio/hugo-mod-heroicons"

And then using your example in my template:

{{ $icon := resources.Get "svg/heroicons/outline/search.svg" }} 
{{ $icon.Content | safeHTML }}

resulted in the following error:

Error: Error building site: failed to render pages: render of "home" failed: "/Users/ericbrookfield/Development/quickstart/layouts/index.html:31:12": execute of template failed: template: index.html:31:12: executing "main" at <$icon.Content>: nil pointer evaluating resource.Resource.Content

Suggestion: mount optimized icons

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>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.