fix: Add --preferPlainHtml flag#2724
Conversation
| // Try .plain.html | ||
| const plainHtmlFile = path.resolve( | ||
| // Try second extension | ||
| const secondFile = path.resolve( |
There was a problem hiding this comment.
rather than first/second have you considered an approach where an arbitrary length array of options is allowed? (if it helps simplify, otherwise probably not worth it)
There was a problem hiding this comment.
I agree, create a helper function that resolves the local file and iterate over the candiates.
|
@davidnuescheler @kptdobe why is there a fallback to |
|
Because you approved it - see #2631 |
|
In experience modernization agent we're generating .plain.html that are both used to show the user a "preview" of their content and then get uploaded to DA once the user is satisfied. Considering the new "aem content" approach it might make sense to look at going "back" to generating .md files, but for now we're still using ".plain.html", so it makes sense to have a way to have a way to "prioritize them". |
@karlpauls I'm not sure anymore why we need to serve the |
|
The goal was to serve local content as it would come from the edge. Originally, the html folder feature only served full HTML files (including a With #2631, we added support for serving a plain.html file, matching what .page/index.plain.html would return from the edge. This is simpler to produce and allows the head to be injected/managed separately. For backwards compatibility, a .html file takes precedence over a .plain.html file. Additionally, no injection is applied to .html files - injection only happens for .plain.html. |
| // Try .plain.html | ||
| const plainHtmlFile = path.resolve( | ||
| // Try second extension | ||
| const secondFile = path.resolve( |
There was a problem hiding this comment.
I agree, create a helper function that resolves the local file and iterate over the candiates.
| * @param {string} relativePath path relative to HTML folder (without extension) | ||
| * @param {string} ext extension to append (e.g. '.html', '.plain.html') |
There was a problem hiding this comment.
the relativePath / ext separation is not important to this function, so I would only use 1 argument: relativePath and concat them in the caller.
| if (relativePath.includes('/../')) { | ||
| return null; | ||
| } |
There was a problem hiding this comment.
this is also checked in the validatePathSecurity above... so no need to check here,
tripodsan
left a comment
There was a problem hiding this comment.
thanks. I'll merge it asap
|
merged with #2728 |
Add an opt-in --prefer-plain-html flag to aem up so .plain.html wins over .html sibling in --html-folder mode
Related Issues
https://github.com/Adobe-AEM-Foundation/aem-experience-catalyst/issues/1129