Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

Introduce context.response.hast? #285

Closed
trieloff opened this issue Apr 24, 2019 · 2 comments · Fixed by #281
Closed

Introduce context.response.hast? #285

trieloff opened this issue Apr 24, 2019 · 2 comments · Fixed by #281
Labels
enhancement New feature or request question Further information is requested released

Comments

@trieloff
Copy link
Contributor

In #281 I'm parsing the HTML string from context.response.body, then transform it, then write it back to context.response.body. Great.

For #153 I would benefit from having access to the parsed response HTML, because I could then walk over the AST, find all a elements, and add their hrefs to the link header to enable pre-fetching.

In #122 I would benefit from having access to the parsed response HTML, because I could then walk over the AST, find all meta elements, and add some of them to the response headers.

Therefore, I propose the creation of a new parse-response-html step, a context.response.hast property and a new stringif-response-html step for the HTML pipeline.

@trieloff trieloff added enhancement New feature or request question Further information is requested labels Apr 24, 2019
@tripodsan
Copy link
Contributor

please ensure that the parse->stringify preserves whitespace and comments (at least in debug mode). developers don't like it, when their HTML gets scrambled :-)

trieloff added a commit that referenced this issue Apr 26, 2019
HTML response bodies will now be parsed and then serialized before the final response is created. This creates the opportunity of changing the HTML AST for HTML-post-processing

Fixes #285
adobe-bot pushed a commit that referenced this issue Apr 30, 2019
# [1.10.0](v1.9.2...v1.10.0) (2019-04-30)

### Bug Fixes

* **package:** update @adobe/helix-shared to version 0.10.5 ([54709a9](54709a9))
* **static:** change extension from .esi to .esi ([a936918](a936918))

### Features

* **html:** enable HAST parsing and serialization of HTML responses ([224c665](224c665)), closes [#285](#285)
* **html:** rewrite relative asset references to ESI resources ([dce696e](dce696e)), closes [#267](#267)
* **html:** rewrite static asset references to ESI includes that provide stable URLs ([aa2538f](aa2538f)), closes [#224](#224)
@adobe-bot
Copy link

🎉 This issue has been resolved in version 1.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request question Further information is requested released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants