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

Right way to pass SITE_ID and REMARK_URL to templates #813

Open
akellbl4 opened this issue Nov 10, 2020 · 4 comments
Open

Right way to pass SITE_ID and REMARK_URL to templates #813

akellbl4 opened this issue Nov 10, 2020 · 4 comments

Comments

@akellbl4
Copy link
Collaborator

Now we build frontend and then on the running stage replace these constants with sed. It works only for docker image.
We don't do it for binary packages (correct me if I'm wrong). I will check how it works in it.

I think we should discuss and find out the right way to do it for any kind of build. We found out another one way to do it with serving templates on Go and insert them. This way also has another advantage: we can rid off the request to get config and pass it in the template right on sending HTML to a client.

cc @umputun @paskal

Related: #567 #806

@paskal
Copy link
Sponsor Collaborator

paskal commented Nov 29, 2020

HTML generation is a messy task no matter where you do it, and usually, I would vote against coupling frontend and backend in such a strong way. But, as we have such a small amount of the HTML I think it's not that bad, and I would indeed be glad to get rid of sed. I think we should go for it. @umputun?

@umputun
Copy link
Owner

umputun commented Jan 20, 2021

I don't think such a coupling worths it as seds replacement. However processing html/js on the server side (like applying templates and setting extra headers) has many other good uses. For example, support of styles upload via server API and applying styles on the fly. Another example - setting some headers, like frame-ancestors, dynamically.

So, as much as I don't like the potential coupling, in our case it may have some valuable benefits.

@paskal
Copy link
Sponsor Collaborator

paskal commented Jan 8, 2023

@akellbl4 I see that now we have some hardcoded variables next to the htmlWebpackPlugin.options. Can we reuse the same mechanism for SITE_ID for consistency?

    site_id: 'remark',
    host: '<%= htmlWebpackPlugin.options.REMARK_URL %>',

@paskal
Copy link
Sponsor Collaborator

paskal commented Jan 8, 2023

cc @sattellite as he seems to be the person who added it in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants