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

Should we add a line in the readme files encouraging theme developers to add a sizes attribute? #30

Closed
tevko opened this issue Jan 24, 2015 · 3 comments
Labels

Comments

@tevko
Copy link
Member

tevko commented Jan 24, 2015

I think it would only improve the performance of the site. Especially during a case where the browser thinks an image needs full resolution at 100vw, when it really only needs a fraction of that. @Wilto

@tevko tevko added the question label Jan 24, 2015
@joemcgill
Copy link
Member

I think we may want to revisit the idea of passing an $args parameter to the template tag, which could be used by developers for setting the sizes attribute along with the srcset attribute in their themes. I would imagine something like:

tevkori_get_src_sizes( $id, $size, $args );

Where $args accepts an array like so:

$args = array(
  'sizes' => array(
    [0] => array(
      'width' => '100vw',
      'media-query' => 'max-width: 30em',
    ),
    [1] => array(
      'width' => '50vw'
      'media-query' => 'max-width: 50em',
    ),
    [2] => array(
      'width' => 'calc(33vw - 100px)'
    ),
  )
)

That would at least give developers who want to declare a sizes attribute a way of doing so.

@jhned
Copy link

jhned commented Jan 25, 2015

I agree with @joemcgill, that seems like a really easy way to add it in. I've got an idea for how to implement it (plus a couple of other items), so I'll go ahead and try it.

@tevko
Copy link
Member Author

tevko commented Jan 25, 2015

@jhned awesome, looking forward to your PR !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants