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

chore: Use Sass @use in plop template and README #1793

Merged
merged 6 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion plopfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default function (plop) {
type: 'append',
path: 'packages/css/src/components/index.scss',
pattern: `/* Append here */`,
template: `@import "./{{kebabCase name}}/{{kebabCase name}}";`,
template: `@use "./{{kebabCase name}}/{{kebabCase name}}";`,
},
{
type: 'add',
Expand Down
14 changes: 10 additions & 4 deletions proprietary/tokens/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,22 @@ Note that redefining the value of a token is a much better approach than redecla
## Usage in Sass

The tokens can be imported as Sass variables as well.
As they are already prefixed, the namespace that Sass would assign isn’t necessary.

```sass
@import "@amsterdam/design-system-tokens/dist/index.scss"
@use "@amsterdam/design-system-tokens/dist/index.scss" as *;
```

Import the compact tokens if you need them.
Sass will override spacious values automatically.
Import the compact tokens if needed.
Note that Sass doesn't allow importing them alongside the default set due to naming conflicts.
Address these tokens through the `compact` namespace and do not use the spacious tokens they replace.

```sass
@import "@amsterdam/design-system-tokens/dist/compact.scss"
@use "@amsterdam/design-system-tokens/dist/compact.scss";
VincentSmedinga marked this conversation as resolved.
Show resolved Hide resolved

.class {
padding-block: compact.$ams-space-md;
}
```

## Usage in JavaScript
Expand Down
Loading