gohugoio / hugo-mod-heroicons Goto Github PK
View Code? Open in Web Editor NEWWork In Progress: Provides Heroicons as a simple to use Hugo Module
License: MIT License
Work In Progress: Provides Heroicons as a simple to use Hugo Module
License: MIT License
#10614 #12568 heyitsquoracom:patch-2 #10605 #12480
Originally posted by @Heyitsquoracom in gohugoio/hugo#12568 (comment)
#4 #7
Originally posted by @Heyitsquoracom in #8 (comment)
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
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.
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>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.