al-quran_kaios/nanoc/rules/random.rules

23 lines
619 B
Text
Raw Normal View History

2024-10-17 04:57:13 +02:00
#!/usr/bin/env ruby
# frozen_string_literal: true
##
# Contains rules for a redirect from /<locale>/random/ to a
# random surah (eg /en/random/ -> /en/al-kahf/)
locales.each do |locale|
compile "/html/main/random.html.erb", rep: "random/#{locale}" do
context = Ryo.from({dir: tdata[locale].dir, locale:, locales:})
filter(:erb, locals: {context:})
filter(:tidy, exe: tidy)
write("/#{locale}/random/index.html")
end
end
compile "/js/main/random.ts" do
filter :webpack,
argv: ["--config", "etc/webpack.#{buildenv}.js"],
depend_on: ["/js/lib/"]
write("/js/main/random.js")
end