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

Add guide for using config variables #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ The following tasks can be used when you want to start developing the extension
## Packaging
Run `npm run dist` to create a zipped, production-ready extension for each browser. You can then upload that to the appstore.

## Using config variables
The files in your `src/scripts` directory are run through a preprocessor during the build stage, and you can use this to set custom data variables based on your environment (Development/Product) or platform (Chrome/Firefox/Opera).
1. In your `config` directory, add whatever variables you want to set, for instance, `API_URL`
2. In your code, use `/* @echo API_URL */` and the preprocessor will replace it with the correct value based on environment and platform
3. If building for production, set the environment variable `NODE_ENV` to `production` and your production variables will get filled in

## TODO
- [ ] Add support for Safari
Expand Down