al-quran.reflectslight.io/nanoc/rules/random.rules
2024-06-14 23:31:39 -03:00

22 lines
667 B
Ruby

#!/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({filename: "random.html.erb", dir: tdata[locale].dir, locale:, locales:})
filter(:erb, locals: {locale:, locales:, dir: context.dir, context:})
filter(:tidy)
write("/#{locale}/random/index.html")
end
end
compile "/js/main/random.ts" do
filter(:webpack, exe: tidy, depend_on: ["/js/lib/"])
write("/js/main/random.js")
filter(:gzip)
write("/js/main/random.js.gz")
end