Skip to content

Commit

Permalink
Use the assets pipeline to load inert.css (mastodon#28701)
Browse files Browse the repository at this point in the history
  • Loading branch information
renchap authored Jan 12, 2024
1 parent a906960 commit c6684aa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/javascript/packs/inert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* Placeholder file to have `inert.scss` compiled by Webpack
This is used by the `wicg-inert` polyfill */

import '../styles/inert.scss';
2 changes: 2 additions & 0 deletions public/inert.css → app/javascript/styles/inert.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* This is needed for the wicg-inert polyfill */

[inert] {
pointer-events: none;
cursor: default;
Expand Down
4 changes: 3 additions & 1 deletion app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@

= stylesheet_pack_tag 'common', media: 'all', crossorigin: 'anonymous'
= stylesheet_pack_tag current_theme, media: 'all', crossorigin: 'anonymous'
-# Needed for the wicg-inert polyfill. It needs to be on it's own <style> tag, with this `id`
= stylesheet_pack_tag 'inert', media: 'all', id: 'inert-style'

= javascript_pack_tag 'common', crossorigin: 'anonymous'
= preload_pack_asset "locale/#{I18n.locale}-json.js"
= csrf_meta_tags unless skip_csrf_meta_tags?
%meta{ name: 'style-nonce', content: request.content_security_policy_nonce }

= stylesheet_link_tag '/inert.css', skip_pipeline: true, media: 'all', id: 'inert-style'
= stylesheet_link_tag custom_css_path, skip_pipeline: true, host: root_url, media: 'all'

= yield :header_tags
Expand Down

0 comments on commit c6684aa

Please sign in to comment.