1
mirror of https://github.com/jakejarvis/hugo-mod-twemoji.git synced 2025-04-28 05:40:29 -04:00

bundling twemoji.min.js into this repo for simplicity, since it's in a different branch upstream

https://github.com/twitter/twemoji/blob/gh-pages/v/12.1.5/twemoji.min.js
This commit is contained in:
Jake Jarvis 2020-04-07 16:19:10 -04:00
parent 7c33c7241c
commit d0b6bdbd4b
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
3 changed files with 24 additions and 3 deletions

View File

@ -16,6 +16,28 @@ Add the module to your Hugo project's `config.toml`:
The graphics will be mounted in `static/twemoji/png` and `static/twemoji/svg`, and the scripts in `static/twemoji/js`.
You'll want to call the script somewhere in your template or theme's `<head>`, for example:
```go
<script src="{{ "twemoji/js/twemoji.min.js" | absURL }}"></script>
```
...and then in order to actually swap out the emojis, you need to call the script's `.parse` method. This is where you can choose between PNGs or SVGs and tell the script where we've placed the graphics. A good starting point is:
```html
<script>
twemoji.parse(document.body, {{ dict "base" ("/" | absURL) "folder" "twemoji/svg" "ext" ".svg" | jsonify | safeJS }})
</script>
```
After building the site this script will turn into something like:
```html
<script>
twemoji.parse(document.body, {"base": "https://hugo-mod-twemoji.netlify.com/", "ext": ".svg", "folder": "twemoji/svg"})
</script>
```
## License
Twemoji graphics are licensed under [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0/) (CC-BY-4.0) by Twitter, Inc. and other contributors. Code is licensed under the [MIT License](http://opensource.org/licenses/MIT).

View File

@ -10,6 +10,3 @@
[[module.imports.mounts]]
source = "assets/svg"
target = "static/twemoji/svg"
[[module.imports.mounts]]
source = "scripts"
target = "static/twemoji/js"

2
static/twemoji/js/twemoji.min.js vendored Normal file

File diff suppressed because one or more lines are too long