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

Feature Request: Single Page Application support for the HTML plugin. #138

Open
gartz opened this issue Mar 31, 2023 · 1 comment
Open

Comments

@gartz
Copy link

gartz commented Mar 31, 2023

Inline JavaScript or CSS

In certain scenarios, incorporating inline JavaScript or CSS directly into the HTML file can be beneficial. It would be advantageous to have the option to either:

  1. Write the code directly in the HTML as inline and avoid extracting it to a separate file.
  2. Write the code in a file with a naming convention like code.inline.js and append it inline when generating the HTML file.

For instance, embedding website metrics as inline code can be useful, as they should be triggered during the document load. Moreover, this approach can be valuable for Single Page Application (SPA) loading screens, where ideally styles and even small images can be embedded to display as quickly as possible.

Configure Static Path

Currently, the plugin always adds a relative path such as ./file... or ../file.... However, this poses an issue for SPAs, as they allow loading from any URL path. Sub-folders can cause the relative path to fail.

To resolve this issue, an option for a public path (e.g., /) should be added, enabling access from any path. Additionally, using an external URL would permit the utilization of a Content Delivery Network (CDN) for asset deployment.

@stale stale bot added the wontfix This will not be worked on label May 30, 2023
@chialab chialab deleted a comment from stale bot Jun 8, 2023
@edoardocavazza edoardocavazza removed the wontfix This will not be worked on label Jun 8, 2023
@edoardocavazza
Copy link
Member

Hi @gartz !

Thanks for your suggestions, and sorry for the late reply.

With this PR we aim to add support for the publicPath option, which should (I think) solve some of the issues you raised.

As for the section on the inline option, I'm not sure I understand the case and the benefit. Why can't that code be written inside a <script> tag without src?

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

No branches or pull requests

2 participants