Skip to content
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

Add support to type, media and crossorigin attributes #2

Open
andrevandal opened this issue Dec 11, 2018 · 0 comments
Open

Add support to type, media and crossorigin attributes #2

andrevandal opened this issue Dec 11, 2018 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@andrevandal
Copy link
Contributor

Hi.

According to Netlify post, link path should have rel and as and Fonts should crossorigin tag with two acceptable values (anonymous or use-credentials). (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-crossorigin)

And a type and media attributes also should be acceptable. (Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content)

Exemple:

Link: </js/example-script.js>; rel=preload; as=script
Link: </font/example-font.woff2>; rel=preload; as=font; crossorigin=anonymous
Link: </images/bg-image-narrow.png>; rel=preload; as=image; media='(max-width: 600px)'

Looking in transformer.js:

module.exports.netlify = (headers, headersFile) => {
  const netlifyHeader = headers.map(
    ({source, headers}) => `${source}\n\tLink: ${headers}`
  );
  fs.appendFileSync(headersFile, '\n' + netlifyHeader.join('\n'));
}; 

I think the only solution is test headers extentions to add as (and crossorigin to fonts) based on file's type.
What do you think?

@ekoeryanto ekoeryanto added the help wanted Extra attention is needed label Dec 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants