kalamuna / kalastatic

:electric_plug: Facilitate the front-end experience through Styleguides and Prototypes
https://kalamuna.github.io/kalastatic/
41 stars 14 forks source link

Allow API to take options array #612

Open HakS opened 5 years ago

HakS commented 5 years ago

I can't figure out how to use KalaStatic in a node script, it says it needs a path in the parameter like thi KalaStatic('path/to/site'), however this wouldn't work, since in the source it accepts something like an object, which has a method defaults(), and I can't find anything about how to build this object this KalaStatic function expects.

RobLoach commented 5 years ago

Hmm, should update those docs. It currently takes an nconf object to allow multiple config locations.

const Kalastatic = require('kalastatic')
const nconf = require('nconf')

nconf.file('config.json')

const kstat = Kalastatic(nconf)
kstat.build().then(function () {
  console.log("DONE!")
})

We could make it take an options array, or a base path, instead. Might make it easier to set up on the API side.

HakS commented 5 years ago

That's a good idea! Other thing that might work would be to look for a config file in the root of the node script being perhaps? load this config and send it to Kalastatic

But I guess that's another ticket