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
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
components = {
|
components = {
|
||||||
'react-newtask' => 'tasks/new',
|
'react-task' => ['tasks/new', 'tasks/edit'],
|
||||||
'react-edittask' => 'tasks/edit',
|
'react-tasks' => [ '/', 'tasks'],
|
||||||
'react-tasks' => 'tasks',
|
'react-projects' => ['projects']
|
||||||
'react-projects' => 'projects'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
components.each do |name, path|
|
components.each do |name, paths|
|
||||||
compile '/html/react.html.erb', rep: name do
|
compile '/html/react.html.erb', rep: name do
|
||||||
filter(:erb, locals: {name:, path: "/#{path}", src: "/js/main.js"})
|
filter(:erb, locals: {name:, src: "/js/main.js"})
|
||||||
write("/#{path}/index.html")
|
paths.each do |path|
|
||||||
|
path == "/" ? write("/index.html") : write("/#{path}/index.html")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,7 @@ import { Task } from "~/components/Task";
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
const components = {
|
const components = {
|
||||||
"react-newtask": () => (
|
"react-task": () => (
|
||||||
<App>
|
|
||||||
<Task />
|
|
||||||
</App>
|
|
||||||
),
|
|
||||||
"react-edittask": () => (
|
|
||||||
<App>
|
<App>
|
||||||
<Task />
|
<Task />
|
||||||
</App>
|
</App>
|
||||||
|
|
Loading…
Reference in a new issue