ss-localconfigs

load and apply per app configuration from client/code/<apps>/socketstream.json

npm install ss-localconfigs
8 downloads in the last week
16 downloads in the last month

What

load and apply per app configuration from client/code/[...APPS...]/socketstream.json

Rationale

By locating individual socketstream configuration in each client/code subdirectories, we limit the amount of boilerplate code that needs to be added to the main app.js file.

We also make it easier to move apps from one server to another.

Usage

In your main app.js of your socketstream application:

var configs = require('ss-localconfigs');
configs.applyConfigs(ss, './client/code', '.socketstream.json');

Configuration file example

An example of configuration file:

client/code/mc/.socketstream.json

{
  "name": "mc",
  "route": "/",
  "view": "mc.html",
  "css": ["bootstrap"],
  "code": [ 
    "libs/jquery.min.js", 
    "libs/knockout-2.1.0.js", 
    "libs/bootstrap.js", 
    "libs/jquery.sparkline.min.js", 
    "libs/knockout.mapping-latest.js", 
    "mc"],
  "tmpl": "*"
}

You can omit name and route in which case the directory name is used:

client/code/app/.socketstream.json

{
  "view": "app.html",
  "css":  ["app.styl"],
  "code": ["libs/jquery.min.js", "app"],
  "tmpl": "*"
}

TODO

  • convert to coffee and integrate to main socketstream?
  • ignore dot files (make it easier to disable a particular app)
  • add tests
  • detect and abort on conflicting configurations
npm loves you