This Hugo theme component is designed to be used with the Hugo Pipes
feature. It offers ways to have modules add their own assets or particles to JavaScript and Stylesheet pipelines.
ℹ️
Note
It’s currently in development and while it’s ready for use, its documentation might lack. Open an issue to find out more or to contribute.
will import all plugged in Javascripts that are registered via modules. For this to work the @import or initialization call needs to be processed within a GoHugo JS Pipe
.
Import via precompiled JS
Stylesheets and SASS
Automatic import via GoHugo Pipes
assets/scss/plugins.scss imports all plugged in stylesheets that are registered via modules. For this to work the file needs to be processed in the layout file and then imported from your GoHugo SASS pipe
This GoHugo module streamlines the addition of SVG-based icon sets to your Hugo website, utilizing the efficient method of defining icons once using <symbol> and reusing them with <use>. By default, the module includes icon sets as an example, but is designed to support any SVG icon set you wish to integrate.
Key features
Flexible Icon Integration: Add any SVG-based icon set to your website.
Efficient Caching Mechanism: Icons are defined once and reused, improving performance.
Bootstrap Icons Included: The Bootstrap Icons set is provided by default for immediate use and as an example for integrating other icon sets.
To use an icon in your layout, call it as a partial in your templates. The example below demonstrates how to include a Bootstrap icon, but the same method applies to any SVG icon you add to the module:
Make sure to replace custom with the name of your icon set and node_modules/custom-icon-set/icons/%s.svg with the path to your icons. The %s placeholder is being replaced with the icon name when the icon is called.
The slug parameter is used to reference the icon set in your layouts and shortcodes and add classes to format them. The classes created in the preceding sample would be icon--custom and icon--iconname where iconname is the icon loaded.
Reference your custom icons using the partials methods preceding.
Migration guide
From versions 1.2024.0 and below
Older versions of this module may have added icons directly each time a shortcode or partial was called, leading to performance issues. The current version improves upon this by including icons once and then reusing them by reference. To migrate to the latest version:
There are no breaking changes; update your partials and shortcodes according to the usage guide.
Replace direct calls to specific icon sets (for example bsicon, heroicon) with calls to icon.html, passing the icon name or setting a global icon type.
Do not cache the icon-partial calls in your layouts; the module handles this for you.