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

How to use config variables and JS preprocessor #33

Open
grexican opened this issue Dec 20, 2018 · 0 comments
Open

How to use config variables and JS preprocessor #33

grexican opened this issue Dec 20, 2018 · 0 comments

Comments

@grexican
Copy link

Not an issue, as much as it a tutorial for those wanting/needing to use config variables.

In my development.json I defined a variable "apiUrl": "https://api.test.com" In production it's "https://api.prod.com"

How do you use it?
In my popup.js file:

var api = '/* @echo api */';

I stumbled upon the solution through trial and error and reading the documentation at : https://www.npmjs.com/package/preprocess

That does var text = 'Hi, I am <!-- @echo USERNAME -->'; as an example. The syntax probably would have worked too, but I chose JS style block comment and it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant