al-quran.reflectslight.io/nanoc/rules/surah-stream.rules

55 lines
1.5 KiB
Text
Raw Normal View History

#!/usr/bin/env ruby
2023-03-11 18:31:44 +01:00
# frozen_string_literal: true
2024-05-04 02:28:26 +02:00
##
# Contains rules for the the surah stream available
2024-05-02 16:29:46 +02:00
# at /<locale>/<name>/, /<locale>/<id>/
2024-05-15 04:08:04 +02:00
compile "/json/*/*/{surah,info}.json" do
write(item.identifier.to_s)
if File.size(item.raw_filename) > (1024 * 10)
2023-06-30 00:49:42 +02:00
filter :gzip
write("#{item.identifier}.gz")
end
end
Ryo.each(name_by_id) do |id, slug|
write_file = ->(locale, pathname:) do
2024-08-13 21:59:59 +02:00
surah = surahs[locale][id.to_i - 1]
context = Ryo.from(locale:, locales:, surah:, dir: tdata[locale].dir)
filter(:erb, locals: {context:})
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
2024-03-16 08:56:56 +01:00
compile "/js/main/surah-stream.tsx" do
2024-08-30 15:16:42 +02:00
filter :webpack,
argv: %W[--config etc/webpack.#{buildenv}.js],
depend_on: [
"/js/components",
"/js/lib",
"/js/hooks",
"/css"
]
2024-03-16 08:56:56 +01:00
write "/js/main/surah-stream.js"
2023-06-30 00:49:42 +02:00
filter :gzip
2024-03-16 08:56:56 +01:00
write "/js/main/surah-stream.js.gz"
end
compile "/js/loaders/SurahStreamLoader.ts" do
2024-08-30 15:16:42 +02:00
filter :webpack,
argv: %W[--config etc/webpack.#{buildenv}.js]
write "/js/loaders/surah-stream-loader.js"
2024-06-09 06:02:08 +02:00
filter :gzip
write "/js/loaders/surah-stream-loader.js.gz"
end