# @limetech/mdc-feature-targeting

> Material Components for the web Feature Targeting Scss helpers

Latest version **4.0.1-p4.0.0.1** (published 2019-12-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @limetech/mdc-feature-targeting
pnpm add @limetech/mdc-feature-targeting
yarn add @limetech/mdc-feature-targeting
bun add @limetech/mdc-feature-targeting
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.1-p4.0.0.1 |
| Published | 2019-12-09 |
| First published | 2019-06-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 13 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | calleboketoft, cybercap, flippare, specularrain, thomaslundstrom |
| Keywords | material components, material design, feature targeting |

## Links

- npm: https://www.npmjs.com/package/@limetech/mdc-feature-targeting
- Repository: https://github.com/Lundalogik/material-components-web
- Homepage: https://github.com/Lundalogik/material-components-web#readme
- Issues: https://github.com/Lundalogik/material-components-web/issues
- npm.io page: https://npm.io/package/@limetech/mdc-feature-targeting

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 4.0.1-p4.0.0.1 (latest) — 2019-12-09
- 4.0.0 — 2019-12-02
- 3.1.0 — 2019-08-29
- 3.0.0 — 2019-08-29
- 0.44.1 — 2019-06-26

## README

<!--docs:
title: "Feature Targeting"
layout: detail
section: components
excerpt: "Provides infrastructure to allow CSS styles to be included or excluded categorically."
path: /catalog/feature-targeting/
-->

# Feature Targeting

MDC Feature Targeting provides infrastructure to allow CSS styles to be included or excluded categorically.

Most of the time, you shouldn't need to depend on `mdc-feature-targeting` directly. However, understanding it can be useful if you're interested in having more control over when certain types of MDC styles are emitted.

## Installation

```
npm install @limetech/mdc-feature-targeting
```

## Basic Usage

### Styles

Authoring component styles:

```scss
@import "@limetech/mdc-feature-targeting/functions";
@import "@limetech/mdc-feature-targeting/mixins";

@mixin my-component-core-styles($query: mdc-feature-all()) {
  $feat-structure: mdc-feature-create-target($query, structure);

  @include mdc-feature-targets($feat-structure) {
    // ...
  }
}
```

Consuming component styles:

```scss
@import "@limetech/mdc-feature-targeting/functions";
@import "my-component-mixins";

// To include all styles (using the default of mdc-feature-all() defined above):
@include my-component-core-styles;

// Or, to include a specific subset of styles:
@include my-component-core-styles(structure);
@include my-component-core-styles(mdc-feature-any(color, typography));
// The above two @includes and the following @include would produce equivalent results:
@include my-component-core-styles(mdc-feature-without(animation));
```

## Sass Mixins and Functions

Mixin | Description
--- | ---
`mdc-feature-targets($feature-targets...)` | Conditionalizes content to only be emitted if the given feature target(s) is/are queried.

Function | Description
--- | ---
`mdc-feature-create-target($feature-query, $targeted-feature)` | Returns a variable to be passed to `mdc-feature-targets` in order to filter emitted styles.
`mdc-feature-all($feature-queries...)` | Returns a query object which will result in emitting `mdc-feature-targets` blocks that match _all_ of the specified features. Passing no arguments results in all blocks being emitted, which is the most common use case.
`mdc-feature-any($feature-queries...)` | Returns a query object which will result in emitting `mdc-feature-targets` blocks that match _any_ of the specified features. Passing no arguments results in no blocks being emitted.
`mdc-feature-without($feature-query)` | Returns a query object which will result in emitting `mdc-feature-targets` blocks that do _not_ match the specified feature.

`$feature-query` and `$feature-queries` refer to one or more of the values listed below under Supported Features.

### Supported Features

MDC Web's styles are currently split according to the following features:

* `structure` - All baseline styles that don't fit into any other category
* `animation` - Styles responsible for causing animations and transitions to occur
* `color` - Color-specific styles which rely on `mdc-theme` variables
* `typography` - Typography-specific styles which rely on `mdc-typography`

---
_Source: https://npm.io/package/@limetech/mdc-feature-targeting · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
