Skip to content

Commit

Permalink
docs: standardise offline handler in js (#4341)
Browse files Browse the repository at this point in the history
  • Loading branch information
dabeeeenster authored Jul 18, 2024
1 parent 2510636 commit a17c514
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/docs/clients/client-side/javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,21 +115,21 @@ try {
}
```

### Providing Default Flags as part of CI/CD
### Default Flag Offline Handler

You can automatically set default flags for your frontend application in CI/CD by using our
[CLI](https://github.com/Flagsmith/flagsmith-cli) in your build pipelines.
You can automatically set default flags for your frontend application as part of your CI/CD process by using our
[CLI](/clients/CLI) and offline hander in your build pipelines.

The main steps to achieving this are as follows:

1. Install the CLI `npm i flagsmith-cli --save-dev`
2. Call the CLI as part of npm postinstall to create a `flagsmith.json` each time you run `npm install`. This can be
done by either:
1. Install the [CLI](/clients/CLI) `npm i flagsmith-cli --save-dev`
2. Call the CLI as part of npm postinstall to create a `flagsmith.json` file each time you run `npm install`. This can
be done by either:

- Using an environment variable `export FLAGSMITH_ENVIRONMENT=<YOUR_CLIENT_SIDE_ENVIRONMENT_KEY> flagsmith get`
- Manually specifying your environment key `flagsmith get <YOUR_CLIENT_SIDE_ENVIRONMENT_KEY>`.

3. In your application, initialise Flagsmith with the resulting JSON, this will set default flags before attempting to
3. In your application, initialise Flagsmith with the resulting JSON. This will set default flags before attempting to
use local storage or call the API. `flagsmith.init({environmentID: json.environmentID, state:json})`

A working example of this can be found [here](https://github.com/Flagsmith/flagsmith-cli/tree/main/example). A list of
Expand Down

0 comments on commit a17c514

Please sign in to comment.