Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the need for a blank foobar.html.erb #47

Open
jho406 opened this issue Apr 15, 2024 · 0 comments
Open

Remove the need for a blank foobar.html.erb #47

jho406 opened this issue Apr 15, 2024 · 0 comments
Labels

Comments

@jho406
Copy link
Collaborator

jho406 commented Apr 15, 2024

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. You don't have to jump into development right away, i'm open to a discussion on how this can be done.

@jho406 jho406 added the triage label Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Needs planning
Development

No branches or pull requests

1 participant