egoist / style-inject

Inject style tag to document head.
MIT License
48 stars 23 forks source link

feat(style-inject): enable AMP inject #9

Open saschazar21 opened 4 years ago

saschazar21 commented 4 years ago

This PR adds the functionality to inject the CSS string in a <style amp-custom>...</style> tag, as intended by the AMP project.

Functionality: It queries the <head> for an already available amp-custom tag, and appends the CSS string to its contents. If no amp-custom was found, it appends a new <style amp-custom /> element as a child of the document's head.

The previous functionality was preserved, so it's still backwards compatible.

ivoilic commented 3 years ago

@saschazar21 I've added this feature in an improved version of this package: style-implant