Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leon-dunamu/svelte-use-env
use env for svelte/templates
https://github.com/leon-dunamu/svelte-use-env
environment-variables npm svelte svelte-template
Last synced: 26 days ago
JSON representation
use env for svelte/templates
- Host: GitHub
- URL: https://github.com/leon-dunamu/svelte-use-env
- Owner: leon-dunamu
- License: mit
- Created: 2021-02-15T12:55:48.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-29T15:56:00.000Z (almost 3 years ago)
- Last Synced: 2024-10-02T09:47:42.454Z (about 1 month ago)
- Topics: environment-variables, npm, svelte, svelte-template
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# svelte withe environment variables
The sveltejs/template starter project doesn’t allow the use of environment variables out-of-the-box.
Env can be used by using this module with svelte.
## how to use
### installation
```bash
npm install @goesvt/svelte-use-env
```
### useage
Just following below code.
in `rollup.config.js` file
```jsx
...import insertEnv from "@goesvt/svelte-use-env";
const production = !process.env.ROLLUP_WATCH;
...
export default {
...,
plugins : [
...,
insertEnv(), // insert here !!
],
...
}
```
then, you can create & use `.env` file as follows
```bash
APP_KEY=vr9e29399g83gnrvesd
```
```jsx
/* App.js */console.log(process.env.APP_KEY); // vr9e29399g83gnrvesd
```