al-quran.reflectslight.io/nanoc/rules/surah-stream.rules
0x1eef 03c21f45c7 Rename rules/ files
index.rules  => surah-index.rules
stream.rules => surah-stream.rules
2024-06-22 00:17:50 -03:00

68 lines
1.8 KiB
Ruby

#!/usr/bin/env ruby
# frozen_string_literal: true
##
# Contains rules for the the surah stream available
# at /<locale>/<name>/, /<locale>/<id>/
compile "/json/*/*/{surah,info}.json" do
write(item.identifier.to_s)
if File.size(item.raw_filename) > (1024 * 10)
filter :gzip
write("#{item.identifier}.gz")
end
end
Ryo.each(name_by_id) do |id, slug|
write_file = ->(locale, pathname:) do
name = tdata[locale].surahs.names[id.to_i - 1]
context = Ryo.from(
filename: "surah-stream.html.erb",
locale:,
locales:,
surah: {id:, name:, slug:},
dir: tdata[locale].dir
)
locals = {
locale: context.locale, locales: context.locales,
surah: context.surah, dir: context.dir, context:
}
filter(:erb, locals:)
filter(:tidy, exe: tidy)
write "/#{locale}/#{pathname}/index.html"
end
locales.each do |locale|
compile "/html/main/surah-stream.html.erb", rep: "/#{locale}/#{slug}/index.html" do
instance_exec(locale, pathname: slug, &write_file)
end
compile "/html/main/surah-stream.html.erb", rep: "/#{locale}/#{id}/index.html" do
instance_exec(locale, pathname: id, &write_file)
end
end
end
compile "/js/main/surah-stream.tsx" do
filter :webpack, depend_on: [
"/js/components",
"/js/lib/",
"/js/hooks"
]
write "/js/main/surah-stream.js"
filter :gzip
write "/js/main/surah-stream.js.gz"
end
compile "/js/loaders/SurahStreamLoader.ts" do
filter :webpack
write "/js/loaders/surah-stream-loader.js"
filter :gzip
write "/js/loaders/surah-stream-loader.js.gz"
end
compile "/css/main/SurahStream.scss" do
filter :sass, syntax: :scss, style: :compact
filter :rainpress
write("/css/main/surah-stream.css")
filter :gzip
write("/css/main/surah-stream.css.gz")
end