dolphins7.skeleton/client/nanoc/rules/react.rules

21 lines
566 B
Text
Raw Normal View History

2024-04-25 08:40:55 +02:00
#!/usr/bin/env ruby
2024-04-25 09:16:57 +02:00
# frozen_string_literal: true
2024-04-25 08:40:55 +02:00
2024-04-25 10:37:45 +02:00
{
"Task" => ["tasks/new", "tasks/edit"],
"Tasks" => ["/", "tasks"],
"Projects" => ["projects"]
}.each do |component, paths|
compile "/html/react.html.erb", rep: component do
filter(:erb, locals: {name: "react-#{component.downcase}", src: "/js/main.js"})
paths.each do |path|
2024-04-25 09:16:57 +02:00
(path == "/") ? write("/index.html") : write("/#{path}/index.html")
end
2024-04-25 08:40:55 +02:00
end
end
compile "/js/main/main.tsx" do
2024-04-25 09:16:57 +02:00
filter(:webpack, depend_on: %w[/js/components/ /js/hooks/ /js/types/])
2024-04-25 08:40:55 +02:00
write("/js/main.js")
end