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

Make it possible to use it at Media Query [SASS output, %extend svg-common -> @mixin svg-common] #66

Closed
PeterMK85 opened this issue Mar 31, 2015 · 6 comments
Assignees

Comments

@PeterMK85
Copy link

Due to the current limitation of SASS (You can't extend % or . classes in a media query, but you can with a mixin), is there a way to transform the genrated %svg-common into a @mixin ?

The "classes" I was able to alter it down to placeholder (or silent classes) or mixins but because the first property of them is:
@extend %svg-common;

It actually fails during the compile.

@jkphl jkphl self-assigned this Apr 1, 2015
@jkphl
Copy link
Collaborator

jkphl commented Apr 1, 2015

Hi @PeterMK85,

thanks for requesting this feature. In fact, I was reading about this myself a couple of days ago, and I'd also be interested in extending the classes from within media queries. Unfortunately, my time is extremely limited these days ... Would you be able to provide a complete example of how the Sass output (including the mixin) would have to look like? That'd speed it up a lot ...

Thanks & cheers,
Joschi

@PeterMK85
Copy link
Author

uu thanks for the fast reply @jkphl

Its a simple modification

Currently using this:

%svg-common {
    background: url(../images/ingatlanok-sprite-31b23ecd.svg) no-repeat;
}

.svg-breadcrumb--arrow {
    @extend %svg-common;
    background-position: 93.73458312777504% 91.19018404907976%;
}

This need to be modified to this:

@mixin svg-common {
    background: url(../images/ingatlanok-sprite-31b23ecd.svg) no-repeat;
}

.svg-breadcrumb--arrow {
    @include svg-common;
    background-position: 93.73458312777504% 91.19018404907976%;
}

Facts:

By this modification you will loose the aggregated background declaration (%extend working that way, make only one background declaration, where all the classes were in one place) _but_ by this modification its become possible to use it in media querys.

(by a simple prefix modification to generate mixins instead of classes and by this modification the mixins can used in media query (called Sass directive))

Thanks for your effort :)

@jkphl
Copy link
Collaborator

jkphl commented Apr 2, 2015

Ah ok, looks easy. So wouldn't it be sufficient to provide a boolean "mixin" option that toggles between the @mixin and the @extend style?

@PeterMK85
Copy link
Author

Yep that would be great to choose by a parameter 👍

jkphl added a commit that referenced this issue Apr 3, 2015
@jkphl
Copy link
Collaborator

jkphl commented Apr 9, 2015

Continued here.

@jkphl jkphl closed this as completed Apr 9, 2015
@falcik
Copy link

falcik commented May 12, 2017

I'm currently working with a project and I have generated my icons in SCSS with classes instead of mixins. Now I figured out that some of the icons need to be changed within the media queries. Author has provided an option that toggles between @mixin and @extend styles. I wonder if it is possible to have them both? For example all icons use @extend style, but icons with name (as example "my-icon~mixin.svg") would have mixin generated instead of classname?

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

No branches or pull requests

3 participants