Website for NZ Tech Rally, built with Eleventy, and auto deploy on commit via Netlify.
- Node v20+ (installed globally)
npm i
Build and start local server. Keep this running while working onthe project.
npm start
Technique by Christopher Kirk-Nielsen
-
Add
.svg
file tosrc/_includes/svg/
-
Add
.njk
extension to the file -
Open the new svg file and make these edits:
- Set any colour to
currentColor
, and uncoloured background totransparent
- Ensure
<svg>
tag has these attribute settingdclass="icon {{ class }}" aria-hidden="{{ false if title else true }}"
- Add
{% if title %}<title>{{ title }}</title>{% endif %}
as first child of<svg>
- Set any colour to
-
To use in template files, include icons you've just added like this:
{% svg "icon-file-name" %}
To add custom clas name or Icon title...
{% svg "icon-file-name", { class: "icon-class", title: "Icon name" } %}
For a regular SVG file, with the isNjk property set to false
{% svg "grid", { isNjk: false } %}