Add "inline_css" helper method

This commit is contained in:
0x1eef 2023-03-11 10:45:12 -03:00
parent 6d358653c7
commit 07812ffdaa
5 changed files with 16 additions and 12 deletions

8
Rules
View file

@ -38,7 +38,7 @@ require_rules "rules/pages/surah/redirect"
require_rules "rules/pages/surah/id_redirect", {locales:}
##
# Inline JSON rules
# Inline CSS / JSON rules
compile "/i18n.json" do
filter(:minify_json)
write(nil)
@ -54,6 +54,12 @@ compile "/slugs.json" do
write(nil)
end
compile "/css/webpackage.scss" do
filter :sass, syntax: :scss, style: :compact
filter :rainpress
write(nil)
end
##
# Defaults
compile("/**/*") { write(nil) }

View file

@ -7,5 +7,11 @@ module Helper
"#{items[path].compiled_content}" \
"</script>"
end
def inline_css(path)
"<style>" \
"#{items[path].compiled_content}" \
"</style>"
end
end
use_helper Helper

View file

@ -1,15 +1,7 @@
#!/usr/bin/env ruby
##
# Contains rules that are related to assets (eg images, fonts, general CSS, etc)
##
# WebPackage CSS
compile "/css/webpackage.scss" do
filter :sass, syntax: :scss, style: :compact
filter :rainpress
write "/css/webpackge.css"
end
# Contains rules that are related to assets (eg images, fonts, etc)
##
# Fonts

View file

@ -3,7 +3,7 @@
<head>
<title>Al-Quran: Loading</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style class="webpackage"><%= items["/css/webpackage.scss"].compiled_content %></style>
<%= inline_css('/css/webpackage.scss') %>
</head>
<body>
<div class="webpackage loader">

View file

@ -3,7 +3,7 @@
<head>
<title>Al-Quran: Loading</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style class="webpackage"><%= items["/css/webpackage.scss"].compiled_content %></style>
<%= inline_css('/css/webpackage.scss') %>
</head>
<body>
<div class="webpackage loader">