Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zkochan/kibe

A JavaScript snippet aimed to switch JavaScript references on the page for easier development/debugging/testing JavaScript files in different environments.
https://github.com/zkochan/kibe

Last synced: 10 days ago
JSON representation

A JavaScript snippet aimed to switch JavaScript references on the page for easier development/debugging/testing JavaScript files in different environments.

Awesome Lists containing this project

README

        

# kibe

A library for switching JavaScript references on the page for easier development/debugging/testing JavaScript files in different environments.

[![Dependency Status](https://david-dm.org/zkochan/kibe/status.svg?style=flat)](https://david-dm.org/zkochan/kibe)
[![Build Status](https://travis-ci.org/zkochan/kibe.svg)](https://travis-ci.org/zkochan/kibe)
[![npm version](https://badge.fury.io/js/kibe.svg)](http://badge.fury.io/js/kibe)

## Installation

Minify the kibe script by running the `gulp` task and paste it to the head section of your website as inline JavaScript. Configure it in the same script tag.

## Usage example

Lets suppose you are using an A/B testing framework but you want to have the possibility to develop and test the experiments locally. The reference to the file generated by the A/B testing framework can look like `//abdomain.com/foo.js`. You'll want this script to be loaded for all your users. However, during development you'll want to suppress that script and add a reference to a local script, with the new experiment.

With kibe you can substitute JavaScript references on your website. And this will affect only your active browser.

First you have to configure it

``` js
kibe({
def: kibe.js('ab', '//abdomain.com/foo.js'),
dev: kibe.js('ab', 'http://localhost:1155/index.js')
});
```

Now that kibe is on the page, you can execute `kibe('dev')` in the console of the browser and kibe will enter the dev mode. In dev mode, the localhost reference will be added to the page instead of the abdomain.com reference.

## License

The MIT License (MIT)