53 lines
1.1 KiB
Ruby
53 lines
1.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
|
|
locales = %w[en fa ar]
|
|
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
|
|
filter(:erb)
|
|
write("/index.html")
|
|
locales.each do |locale|
|
|
write("/#{locale}/index.html")
|
|
end
|
|
end
|
|
|
|
compile("/manifest.webapp") do
|
|
write("/manifest.webapp")
|
|
end
|
|
|
|
compile("/**/*") { write(nil) }
|
|
layout("**/*", :erb)
|