
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
support-for
Advanced tools
Allows Sass authors to conditionally add support for specific browser versions.
The support-for module allows Sass authors to conditionally add support for specific browser versions to their Sass module or Sass partials.
Autoprefixer is great for conditionally adding vendor prefixes, but sometimes you need more extensive CSS for specific versions of browsers. For example, adding px fallbacks to rem units when you need IE 8 support.
Authors of Sass code with support-for can specify which browser versions they want to support by setting a simple Sass variable, $support-for
.
Here are some example usages:
$support-for: (
safari: 8,
'*': null, // null means "no support" and is the
// default value for any browser not
// specified in $support-for
);
// Normalize-scss uses support-for to conditionally
// output CSS for old and new browsers.
@import "normalize";
'*'
. She also has to support IE 6 and later because the client hates her. $support-for: (
'*': -4,
ie: 6,
);
@import "normalize";
$support-for: (
chrome: 29,
edge: 20,
firefox: 26,
ie: 8,
opera: 14,
safari: 5,
);
@import "normalize";
By the way, here's the default value of $support-for
:
// Support the last 4 versions of all browsers except IE.
$support-for: (
chrome: -4,
edge: -4,
firefox: -4,
ie: 9,
opera: -4,
safari: -4,
'*': -4,
) !default;
support-for()
If a Sass module tells you that it uses support-for, you just need to override the default value of the $support-for
variable before you import that module. See the examples above to see some of your options.
If, however, you want to conditionally include Sass in the stylesheets you author, you can update your Sass code to wrap those lines of Sass with an @if
block that uses the support-for()
function.
@mixin my-sweet-sweet-mixin($cocoa: lots) {
border-radius: 100%;
// Only include this property if we support IE 10.
@if support-for(ie, 10) {
// Remove border when applied to an `img` inside an `a` element in IE 8/9/10.
border: 0;
}
}
If you later drop support for IE 10 (someday!), you just need to update the
$support-for
variable and your code will stop outputting the IE-10-specific
CSS.
If you are a Sass module author wanting to use support-for in your module, it's quite easy to add it as a dependency.
Alter your my-module.gemspec
file:
spec.add_runtime_dependency('sass', '~> 3.3')
spec.add_runtime_dependency('support-for', '~> 1.0')
Add your dependency with the following command:
npm install --save support-for
Add your dependency with the following command:
bower install --save support-for
FAQs
Allows Sass authors to conditionally add support for specific browser versions.
We found that support-for demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.