Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@material/feature-targeting

Package Overview
Dependencies
Maintainers
19
Versions
1649
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@material/feature-targeting

Material Components for the web Feature Targeting Scss helpers

  • 5.0.0-canary.29402e2d4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
429K
decreased by-52.58%
Maintainers
19
Weekly downloads
 
Created

What is @material/feature-targeting?

@material/feature-targeting is a utility package from Material Components for the web (MDC Web) that provides a way to target specific CSS features. It allows developers to write CSS that is conditionally applied based on the presence of certain features, such as CSS variables or specific browser capabilities.

What are @material/feature-targeting's main functionalities?

CSS Variable Support

This feature allows you to write CSS rules that are only applied if the browser supports CSS variables. The mixin `supports-css-variables` checks for CSS variable support and applies the enclosed styles if the feature is available.

/* Import the feature targeting mixins */
@use '@material/feature-targeting/feature-targeting';

/* Define a CSS rule that only applies if CSS variables are supported */
@include feature-targeting.supports-css-variables() {
  .my-class {
    color: var(--my-color, black);
  }
}

Custom Property Fallbacks

This feature allows you to provide fallback styles for browsers that do not support CSS variables. The mixin `supports-css-variables` is used to conditionally apply the CSS variable-based styles, while the fallback styles are applied unconditionally.

/* Import the feature targeting mixins */
@use '@material/feature-targeting/feature-targeting';

/* Define a CSS rule with a fallback for browsers that do not support CSS variables */
.my-class {
  color: black;
  @include feature-targeting.supports-css-variables() {
    color: var(--my-color, black);
  }
}

Other packages similar to @material/feature-targeting

Keywords

FAQs

Package last updated on 17 Jan 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc