Skip to content

[hlx build] Improve static files handling #53

@tripodsan

Description

@tripodsan

As a first approach, the static files are just copied over to .hlx/dist. while this works for local development, it does not work for production. eventually the static files need to be served to the CDN.

similar to the approach in https://github.com/adobe/project-helix/pull/266, the static files could be made available via wsk action. however, I don't think that the wsk-action should load it again from git, because the codeload usually provides too much content.

The static resources could be bundled in the wsk action that delivers them. either in a generic static-server action contains all the resources needed to the project, or alongside the respective html.js action.

Alternatively, a gh-pages approach would be better instead of abusing wsk as a static file server. For each deployment, the static files are committed into a helix-static branch, and the ref of the current state is used in the strains.yaml to configure the static server.

how it works

having a separate static-server action is better, as the fundamental idea of just delivering static assets is easily applied to other mediums (S3, etc.)

  1. the parcel-plugin-htl is enhanced so that it also processes the sub-assets referenced in the htl code Optionally process sub-assets during htl parsing parcel-plugin-htl#16
  2. the plugin generates the .hlx/build/html.js and also the .hlx/dist/* variants of the referenced assets.
  3. the hlx deploy deploys not only the html.js action, but also a static-server action that provides a simple server for the static files or commits the static files into helix-static.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions