Skip to content

Comments

feat(css_helper): add support for custom attributes#3690

Merged
curbengh merged 4 commits intohexojs:masterfrom
curbengh:sri-css
Nov 2, 2019
Merged

feat(css_helper): add support for custom attributes#3690
curbengh merged 4 commits intohexojs:masterfrom
curbengh:sri-css

Conversation

@curbengh
Copy link
Contributor

What does it do?

This is mainly to add subresource integrity (SRI) to <layout>, though arbitrary attributes are supported as well.

Existing syntax is still supported (credit to #3681 (comment)).

Supported syntax:

  • <%- css('layout.css') %>
  • <%- css(['layout.css', 'gallery.css']) %>
  • <%- css({href: 'layout.css', integrity: 'hash-value'}) %>
  • <%- css({href: 'layout.css', integrity: 'hash-value'}) %>
  • <%- css({href: 'layout.css', integrity: 'hash-value'}, {href: 'gallery.css', integrity: 'hash-stuff'}) %>
  • <%- css([{href: 'layout.css', integrity: 'hash-value'}, {href: 'gallery.css', integrity: 'hash-stuff'}]) %>
  • <%- css([{href: 'layout.css', integrity: 'hash-value'}, {href: 'gallery.css', integrity: 'hash-stuff'}]) %>

Related to #3681, without support of async nor defer (not used in <link>).

How to test

git clone -b sri-css https://github.com/curbengh/hexo.git
cd hexo
npm install
npm test

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

@coveralls
Copy link

coveralls commented Aug 27, 2019

Coverage Status

Coverage decreased (-0.01%) to 97.253% when pulling 814b4d8 on curbengh:sri-css into 0670d54 on hexojs:master.

@curbengh
Copy link
Contributor Author

Ready for review.

@curbengh curbengh requested a review from a team October 28, 2019 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants