lofig

Like the Config package, but for client side JavaScript

Usage no npm install needed!

<script type="module">
  import lofig from 'https://cdn.skypack.dev/lofig';
</script>

README

lofig

npmjs.com/package/config, but for client side JavaScript

Installation

npm install lofig --save --production

You can also use https://unpkg.com/lofig@latest/dist/lofig.min.js.

Usage

import 'lofig' from 'lofig'; // not necessary if using CDN Link

// change config folder
lofig.folder = 'config/default.json';

// check if property exists
await lofig.has('secret');

// return property
await lofig.get('secret');

// NOTE: You can also use callbacks e.g.
lofig.get('secret', res => {
    console.log('secret', res);
})

Development

Run npm run dev to use webpack-dev-server for development purposes.