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

22 lines
539 B
Text
Raw Normal View History

2024-04-25 08:40:55 +02:00
#!/usr/bin/env ruby
components = {
'react-task' => ['tasks/new', 'tasks/edit'],
'react-tasks' => [ '/', 'tasks'],
'react-projects' => ['projects']
2024-04-25 08:40:55 +02:00
}
components.each do |name, paths|
2024-04-25 08:40:55 +02:00
compile '/html/react.html.erb', rep: name do
filter(:erb, locals: {name:, src: "/js/main.js"})
paths.each do |path|
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
filter(:webpack, depend_on: %w[/js/components/ /js/hooks/ /js/types/])
write("/js/main.js")
end