chialab / rna

🚀 Build tools for modern web modules and applications.

Home Page:https://chialab.github.io/rna/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

gartz opened this issue · comments

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.

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?