diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 52e997e..9158f4b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,12 +48,9 @@ jobs: - name: Build site run: | ./hugo --source docs/ --verbose - - name: Does twemoji.min.js exist? - run: | - test -f ./docs/public/twemoji/js/twemoji.min.js - name: Are 🌈s imaginary??? (png) run: | test -f ./docs/public/twemoji/png/1f308.png - - name: Is 💓 even real?!?!??! (svg) + - name: Does true 💓 even exist?!?!??! (svg) run: | test -f ./docs/public/twemoji/svg/1f493.svg diff --git a/README.md b/README.md index f3a5637..959eb14 100644 --- a/README.md +++ b/README.md @@ -39,20 +39,23 @@ For a quick start, an optional [partial template](https://gohugo.io/templates/pa ### ⚙️ Manual -If you don't use the partial, you'll want to call the script somewhere in your template or theme's ``, for example: +If you don't use the partial, you'll want to call the `js/twemoji.min.js` asset as [a resource](https://gohugo.io/hugo-pipes/introduction/) somewhere in your template or theme's ``, for example: ```html - +{{ $twemoji := resources.Get "js/twemoji.min.js" }} + ``` ...and then in order to actually swap out the emojis, you need to call the script's `twemoji.parse` method. This is where you can choose between SVGs (recommended) or 72x72 PNGs and tell the script where we've placed the graphics. The [official readme](https://github.com/twitter/twemoji#api) has a _lot_ of information about the API, but a good starting point is this one-liner: ```html ``` +Simply change `svg` and `.svg` to `png` and `.png` respectively to use the provided 72x72 PNG icons instead. + After building the site this small script will turn into something like: ```html diff --git a/static/twemoji/js/twemoji.min.js b/assets/js/twemoji.min.js similarity index 100% rename from static/twemoji/js/twemoji.min.js rename to assets/js/twemoji.min.js diff --git a/config.toml b/config.toml index 0413269..0316d34 100644 --- a/config.toml +++ b/config.toml @@ -2,12 +2,12 @@ [module.hugoVersion] min = "0.64.1" extended = false + [[module.mounts]] + source = "assets" + target = "assets" [[module.mounts]] source = "layouts" target = "layouts" - [[module.mounts]] - source = "static" - target = "static" [[module.imports]] path = "github.com/twitter/twemoji" [[module.imports.mounts]] diff --git a/layouts/partials/twemoji.html b/layouts/partials/twemoji.html index 2ddfc5a..974e2ec 100644 --- a/layouts/partials/twemoji.html +++ b/layouts/partials/twemoji.html @@ -1,2 +1,3 @@ - - +{{ $twemoji := resources.Get "js/twemoji.min.js" }} + +