Skip to content

Commit 9fb1c7d

Browse files
Add scss feature flag option (#1236)
* Add scss feature flag option * Add docs on how to run task * fix formatting * add note about @import
1 parent 3db5105 commit 9fb1c7d

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

contributor-docs/feature-flag-testing.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,26 @@ npm i @primer/primitives-my-feature-flag@npm:@primer/[email protected]
5151

5252
**NOTE:** This package needs to be checked into git. On dotcom all packages are added in git.
5353

54-
### Create a new bundle (optional)
54+
### Load your file
55+
56+
#### Option 1: SCSS feature flag
57+
58+
[Read more about scss feature flags](https://github.com/github/github/blob/10168573894287782ddabd7d8b9bfd47850a1b31/ui/packages/feature-flags/client-feature-flags.ts#L223-L233).
59+
60+
You can't use `@import` inside a feature flag as `@import` has to be top level.
61+
62+
> Note: these flags are all automatically preloaded
63+
64+
```scss
65+
* CSS feature flags can be used in any scss/css file like this:
66+
*
67+
* [data-css-features~="my_feature_flag" i] {
68+
* // styles behind flag
69+
* }
70+
*
71+
```
72+
73+
#### Option 2: Create a new bundle
5574

5675
If you want to load some new tokens you can add a new bundle and load it for users who have the feature flags enabled.
5776

@@ -71,6 +90,11 @@ You now need to load your css bundle if the feature flag is active by placing th
7190
7291
Now you need to generate the `SERVICEOWNERS` and `CODEOWNERS` by running `bin/generate-service-files.rb` in the console or by running it as a task in vs code.
7392
93+
> Note: to run a task in vscoode, open the command palette with `cmd + shift +p` or add a `>` in to the search palette and type `run task`.
94+
> Select `Tasks: Run Task` and hit `return`
95+
> Select `bin/generate-service-files.rb` fromn the list and hit `return`
96+
> Select `Default` and hit return
97+
7498
It should add a line like this to the `SERVICEOWNERS`:
7599

76100
```

0 commit comments

Comments
 (0)