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 viewport-unit mixin #66

Merged
merged 1 commit into from
Mar 10, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions examples/sass/_mixins.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
/* From https://coderwall.com/p/qac-og */

@mixin calc($property, $expression, $x:"") {


#{$property}: -moz-calc(#{$expression}) #{$x};
#{$property}: -webkit-calc(#{$expression}) #{$x};
#{$property}: calc(#{$expression}) #{$x};
}
}

// Mixin for simple using viewport units with buggyfill
// Example include: @include viewport-unit((width: 23.5vw, height: 32vw, background-position: -47.8vw top));
// Its work!)

@mixin viewport-unit($prop-value){
$str:;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be $str: ""; instead?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sass developer says "Sass isn’t very strict with variable types"(http://hugogiraudel.com/2013/07/15/understanding-sass-lists/). Edit as you like.

@each $prop, $value in $prop-value {
#{$prop}: #{$value};
$str: "#{$str} #{$prop}: #{$value};"
}
content: "viewport-units-buggyfill; #{$str}";
}