54 lines
1.5 KiB
Ruby
54 lines
1.5 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
|
|
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
|
|
|
|
compile "/js/main/surah-stream.tsx" do
|
|
filter :webpack,
|
|
argv: %W[--config etc/webpack.#{buildenv}.js],
|
|
depend_on: [
|
|
"/js/components",
|
|
"/js/lib",
|
|
"/js/hooks",
|
|
"/css"
|
|
]
|
|
write "/js/main/surah-stream.js"
|
|
filter :gzip
|
|
write "/js/main/surah-stream.js.gz"
|
|
end
|
|
|
|
compile "/js/loaders/SurahStreamLoader.ts" do
|
|
filter :webpack,
|
|
argv: %W[--config etc/webpack.#{buildenv}.js]
|
|
write "/js/loaders/surah-stream-loader.js"
|
|
filter :gzip
|
|
write "/js/loaders/surah-stream-loader.js.gz"
|
|
end
|