-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(site): remove theming documentation (#1714)
- Loading branch information
Showing
6 changed files
with
58 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,71 @@ | ||
# Shoreline CSS | ||
|
||
The `@vtex/shoreline-css` package transforms shoreline tokens into css. For | ||
example, theme: | ||
The theme files are generated programmatically using the `@vtex/shoreline-css` package. | ||
|
||
## Declaring tokens | ||
|
||
You can declare the `@theme` at-rule to declare the theme: | ||
|
||
```css | ||
@theme example { | ||
--space-1: 1rem; | ||
--space-2: 2rem; | ||
--space-3: 3rem; | ||
--space-gap: var(--space-1); | ||
@theme <theme-name> { | ||
/* css rule */ | ||
} | ||
``` | ||
|
||
will convert to: | ||
For example: | ||
|
||
```css | ||
/* shoreline/styles.css */ | ||
```css filename="tokens.css" | ||
@theme sunrise { | ||
:where(html) { | ||
--space-1: 1rem; | ||
--space-2: 2rem; | ||
--bg-base: #fff; | ||
} | ||
} | ||
``` | ||
|
||
You don't need to prefix the variables, this will be done afterwards. | ||
|
||
## Transforming tokens | ||
|
||
Use the `tokens` function to transform tokens. | ||
|
||
```ts | ||
import { tokens } from '@vtex/shoreline-css' | ||
|
||
tokens({ | ||
inputFile: 'src/tokens.css', | ||
outdir: 'dist', | ||
emitFile: true, | ||
useCascadeLayers: true, | ||
browserslistQuery: 'last 2 versions' | ||
}) | ||
``` | ||
|
||
This code generates the `tokens.css` file in the `outdir` folder. | ||
|
||
```css filename="dist/tokens.css" | ||
@layer sl-tokens { | ||
:root { | ||
:where(html) { | ||
--sl-space-1: 1rem; | ||
--sl-space-2: 2rem; | ||
--sl-space-3: 3rem; | ||
--sl-space-gap: var(--sl-space-1); | ||
--sl-bg-base: #fff; | ||
} | ||
} | ||
``` | ||
|
||
## Bundling | ||
|
||
The `bundle` function [bundles](https://lightningcss.dev/bundling.html) existing css code with the tokens. | ||
|
||
```ts | ||
import { bundle } from '@vtex/shoreline-css' | ||
|
||
bundle({ | ||
inputFile: 'src/styles.css', | ||
tokensFile: 'src/tokens.css' | ||
outdir: 'dist', | ||
useCascadeLayers: true, | ||
browserslistQuery: 'last 2 versions' | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.