Skip to content
This repository was archived by the owner on Jan 21, 2021. It is now read-only.

Conversation

decrek
Copy link

@decrek decrek commented Aug 2, 2019

<link> elements have the ability to accept media attributes. These can accept media types or full-blown media queries, allowing you to do responsive preloading.

I've added the media option to pass the value for the media attribute, like so:

plugins: [
  new HtmlWebpackPlugin(),
  new PreloadWebpackPlugin({
    rel: 'preload',
    media: '(min-width: 600px)'
  })
]

Fixes #69

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@decrek
Copy link
Author

decrek commented Aug 2, 2019

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@decrek
Copy link
Author

decrek commented Aug 2, 2019

@jeffposnick The project is not updated in a while, probably because it is was sort of feature complete, but since then I think some things changed regarding Travis. Could you look into why Travis is failing?

@jeffposnick
Copy link
Contributor

Hey @decrek—Thanks for this submission, and yes, it would be good to get this functionality in.

There was a fairly substantial rewrite to the codebase that was just checked in to master, so unfortunately this PR now has a number of merge conflicts.

If you're still up for contributing the code, the new place to add in that code would be somewhere around

const attributes = {
href,
rel: options.rel,
};

(and then another corresponding change to the test spec.)

If you'd prefer, though, I'm happy to force-push the updates to your PR myself and save you the additional work.

@jeffposnick
Copy link
Contributor

I've got similar changes in https://github.com/GoogleChromeLabs/preload-webpack-plugin/compare/media that is compatible with the current master.

I'm still happy to force-push them into your PR branch if you'd like "official" attribution for the original contributions you've made. (Or you could rebase your PR against that branch.) Alternatively, I can just PR in my changes if you'd rather not bother.

@decrek
Copy link
Author

decrek commented Sep 23, 2019

Hi @jeffposnick I dunno, I tried to to this but I dont see my commit anywhere anymore. But anyways it's all good, glad it gets added

@jeffposnick jeffposnick merged commit 171d8fe into GoogleChromeLabs:master Oct 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

media tag for images [enhancement]
3 participants