Skip to content

Instantly share code, notes, and snippets.

@tobystokes
Created May 22, 2014 10:15
Show Gist options
  • Save tobystokes/20cdae640b7a59f998ec to your computer and use it in GitHub Desktop.
Save tobystokes/20cdae640b7a59f998ec to your computer and use it in GitHub Desktop.
SASS target languages mixin
// select by language, send it one or more comma separated quote-delimited locale codes
// assuming lang attribute is set on the html tag, like it should be!
// usage: @include if-lang("de") {}
// usage: @include if-lang("de", "en", "cn-ZH") {}
@mixin if-lang($locales...) {
@for $i from 1 through length($locales) {
html[lang=#{nth($locales, $i)}] & {
@content;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment