Remove the need for a blank foobar.html.erb
Opened this issue · 0 comments
jho406 commented
A Superglue app’s directory structure looks like this:
app/
|-- controllers/
|-- views/
| |-- dashboard/
| | |-- index.js # The React page component
| | |-- index.json.props # The json for the page component
| | |-- index.html.erb
Almost always index.html.erb
just contains a few lines:
<%% initial_state = controller.render_to_string(active_template_virtual_path, formats: [:json], locals: local_assigns, layout: true) %>
<script type="text/javascript">
window.SUPERGLUE_INITIAL_PAGE_STATE=<%%= initial_state.html_safe %>;
</script>
<div id="app"></div>
Sometimes it may make sense to have that file to override, but is there a way to eliminate the need for these erb files so that the structure looks like:
app/
|-- controllers/
|-- views/
| |-- dashboard/
| | |-- index.js # The React page component
| | |-- index.json.props # The json for the page component
That would be so much cleaner.