Skip to content

Instantly share code, notes, and snippets.

@kimihito
Last active April 22, 2019 05:19
Show Gist options
  • Save kimihito/2a97675699e472cb6b69f18adddca120 to your computer and use it in GitHub Desktop.
Save kimihito/2a97675699e472cb6b69f18adddca120 to your computer and use it in GitHub Desktop.
twemoji + Stimulus.js
!!!
%html
%head
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%title Idone.today
= csrf_meta_tags
= csp_meta_tag
= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload'
%body.bg-gray{ data: { controller: 'emoji-parser'} }
= render 'layouts/header'
.container-lg.clearfix.p-2
= render 'layouts/messages'
= yield
import { Controller } from 'stimulus'
import twemoji from 'twemoji'
export default class extends Controller {
connect() {
twemoji.parse(this.element, { folder: 'svg', ext: '.svg'})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment