al-quran_kaios/Rules
2024-10-18 02:04:19 -03:00

48 lines
1 KiB
Ruby

#!/usr/bin/env ruby
# frozen_string_literal: true
##
# Requires
require "ryo"
require "ryo/json"
require "ryo/yaml"
require "nanoc-webpack"
##
# Extensions
[Nanoc::RuleDSL::CompilationRuleContext, Nanoc::RuleDSL::CompilerDSL].each { _1.prepend(Utils) }
Nanoc::RuleDSL::CompilationRuleContext.prepend(Nanoc::Extension::AnonymousFilter)
Nanoc::RuleDSL::CompilerDSL.prepend(Nanoc::Extension::RequireRules)
##
# Locals
buildenv = ENV["buildenv"] || "development"
##
# Rules
passthrough "/json/**/*.json"
require_rules "nanoc/rules/assets"
compile "/js/vendor.ts" do
filter :webpack,
argv: %w[--config etc/webpack.vendor.js]
write("/js/vendor.js")
end
compile("/js/index.tsx") do
filter :webpack,
argv: ["--config", "etc/webpack.#{buildenv}.js"],
depend_on: ["/js/components", "/js/lib", "/js/hooks", "/css"]
write("/js/index.js")
end
compile("/html/index.html") do
write("/index.html")
end
compile("/manifest.webapp") do
write("/manifest.webapp")
end
compile("/**/*") { write(nil) }
layout("**/*", :erb)