Optimize react render, re-add root path
This commit is contained in:
parent
c36d7c5e12
commit
2f049fd7ce
2 changed files with 9 additions and 13 deletions
|
@ -1,16 +1,17 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
components = {
|
||||
'react-newtask' => 'tasks/new',
|
||||
'react-edittask' => 'tasks/edit',
|
||||
'react-tasks' => 'tasks',
|
||||
'react-projects' => 'projects'
|
||||
'react-task' => ['tasks/new', 'tasks/edit'],
|
||||
'react-tasks' => [ '/', 'tasks'],
|
||||
'react-projects' => ['projects']
|
||||
}
|
||||
|
||||
components.each do |name, path|
|
||||
components.each do |name, paths|
|
||||
compile '/html/react.html.erb', rep: name do
|
||||
filter(:erb, locals: {name:, path: "/#{path}", src: "/js/main.js"})
|
||||
write("/#{path}/index.html")
|
||||
filter(:erb, locals: {name:, src: "/js/main.js"})
|
||||
paths.each do |path|
|
||||
path == "/" ? write("/index.html") : write("/#{path}/index.html")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -7,12 +7,7 @@ import { Task } from "~/components/Task";
|
|||
|
||||
(function () {
|
||||
const components = {
|
||||
"react-newtask": () => (
|
||||
<App>
|
||||
<Task />
|
||||
</App>
|
||||
),
|
||||
"react-edittask": () => (
|
||||
"react-task": () => (
|
||||
<App>
|
||||
<Task />
|
||||
</App>
|
||||
|
|
Loading…
Reference in a new issue