You've already forked hugo-mod-twemoji
mirror of
https://github.com/jakejarvis/hugo-mod-twemoji.git
synced 2025-06-27 16:45:40 -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:
22
README.md
22
README.md
@ -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`.
|
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
|
## 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).
|
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).
|
||||||
|
@ -10,6 +10,3 @@
|
|||||||
[[module.imports.mounts]]
|
[[module.imports.mounts]]
|
||||||
source = "assets/svg"
|
source = "assets/svg"
|
||||||
target = "static/twemoji/svg"
|
target = "static/twemoji/svg"
|
||||||
[[module.imports.mounts]]
|
|
||||||
source = "scripts"
|
|
||||||
target = "static/twemoji/js"
|
|
||||||
|
2
static/twemoji/js/twemoji.min.js
vendored
Normal file
2
static/twemoji/js/twemoji.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user