-
Notifications
You must be signed in to change notification settings - Fork 64
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
[hlx build] Improve static files handling #53
Comments
How would this impact adobe/project-helix#266 ? I would think that static assets are just the fallback case of dynamic assets (when parcel doesn't know what to do with an asset, it copies it). If we can have only one way to deliver assets (static or dynamic), it would definitely simplify things. When it comes to serving assets, I see following options, all coming with some cons:
Right now, 2 and 4 look like better options than 1 or 3. The biggest pain point with 3 would be the resulting multi-branch mess, as you can deploy branches, tags, or commits and you would have branch-branches, tag-branches, and commit-branches to serve the static (or compiled) assets. |
(thanks @trieloff for re-iterating my suggestions :-) I disagree, dealing with a branch similar to gh-pages is not a problem, if you automate it. IMO, abusing openwhisk for static file delivery is the worst of all options (either way, codeload or deployed...) As for parcel, it should only include the (processed) files that are referenced in the content, if possible. especially for clientside CSS and JS, we want parcel to handle it correctly. so it would be good if it can parse the .htl as HTML and process the dependencies. |
Let's create POCs for the 3/4 variants. maybe even pluggable:
|
i think the current way of handling static files could be improved in two ways (1) the file layout in the working directory should be the same as exposed through the URL, meaning that having a (2) i think static files should be able to be placed anywhere in the URL space, if i put an |
as for the deployment of static files, I think we should be careful to introduce more system components like S3 or Azure as well as additional copies in GitHub. It may very well be that we will have to resort to some of these solutions for performance/scale reasons, but for now i think the simplest solution would be to just deploy static files into Adobe I/O runtime as an action. I fully appreciate that there may be multitude of limitations and possibly undesired side-effects with that approach, but I think we should consider exhausting those before introducing additional complexity. |
How would we distinguish between files that are meant to be served statically vs. files that are meant to be served dynamically? Also, I don't think most users would appreciate if we just started serving their template files as is. |
* Petridish should emulate openwhisk controller (Fixes #50) * bump to next minor version
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 thestrains.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.)
.hlx/build/html.js
and also the.hlx/dist/*
variants of the referenced assets.hlx deploy
deploys not only thehtml.js
action, but also astatic-server
action that provides a simple server for the static files or commits the static files intohelix-static
.The text was updated successfully, but these errors were encountered: