{"action":"created","issue":{"url":"https://api.github.com/repos/idyll-lang/idyll/issues/40","repository_url":"https://api.github.com/repos/idyll-lang/idyll","labels_url":"https://api.github.com/repos/idyll-lang/idyll/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/idyll-lang/idyll/issues/40/comments","events_url":"https://api.github.com/repos/idyll-lang/idyll/issues/40/events","html_url":"https://github.com/idyll-lang/idyll/issues/40","id":227488119,"number":40,"title":"JS and CLI API discussion","user":{"login":"bclinkinbeard","id":140343,"avatar_url":"https://avatars1.githubusercontent.com/u/140343?v=3","gravatar_id":"","url":"https://api.github.com/users/bclinkinbeard","html_url":"https://github.com/bclinkinbeard","followers_url":"https://api.github.com/users/bclinkinbeard/followers","following_url":"https://api.github.com/users/bclinkinbeard/following{/other_user}","gists_url":"https://api.github.com/users/bclinkinbeard/gists{/gist_id}","starred_url":"https://api.github.com/users/bclinkinbeard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bclinkinbeard/subscriptions","organizations_url":"https://api.github.com/users/bclinkinbeard/orgs","repos_url":"https://api.github.com/users/bclinkinbeard/repos","events_url":"https://api.github.com/users/bclinkinbeard/events{/privacy}","received_events_url":"https://api.github.com/users/bclinkinbeard/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-05-09T20:29:30Z","updated_at":"2017-05-10T19:34:49Z","closed_at":null,"body":"The current API looks like this in JS: `idyll(inputPath, opts, cb)` where `inputPath` is the absolute path to your `.idl` file, `opts` is an options object, and `cb` is a callback function that will receive the build artifacts once #39 lands.\r\n\r\nThe CLI is of course very similar, since it calls the JS API, looking something like this: `idyll index.idl --layout centered --css styles.css --build`, where `inputPath` is the first argument and everything else is translated to a property on the options object.\r\n\r\nOf note:\r\n- the CLI accepts relative paths \r\n- there is no analog to the callback when using the CLI\r\n\r\nResolution of `inputPath` should definitely move into the JS part so `inputPath` can be a relative path regardless of how Idyll is being used.\r\n\r\n**Questions**\r\n- Should the CLI return a stream or something to support piping into something else? Seems low priority.\r\n- How should we support passing in Idyll source, rather than forcing the reading of a `.idl` file from disk?\r\n\r\nOne approach that seems fairly simple would be to support the omission of `inputPath` entirely, and in that scenario look for a `inputSrc` (or similar) property on `opts`. This is similar to how Browserify allows you to [specify `opts.entries`](https://github.com/substack/node-browserify#browserifyfiles--opts) instead of providing `files` as the first argument to the `browserify()` function.\r\n\r\nThoughts @mathisonian @rreusser et al?"},"comment":{"url":"https://api.github.com/repos/idyll-lang/idyll/issues/comments/300589546","html_url":"https://github.com/idyll-lang/idyll/issues/40#issuecomment-300589546","issue_url":"https://api.github.com/repos/idyll-lang/idyll/issues/40","id":300589546,"user":{"login":"bclinkinbeard","id":140343,"avatar_url":"https://avatars1.githubusercontent.com/u/140343?v=3","gravatar_id":"","url":"https://api.github.com/users/bclinkinbeard","html_url":"https://github.com/bclinkinbeard","followers_url":"https://api.github.com/users/bclinkinbeard/followers","following_url":"https://api.github.com/users/bclinkinbeard/following{/other_user}","gists_url":"https://api.github.com/users/bclinkinbeard/gists{/gist_id}","starred_url":"https://api.github.com/users/bclinkinbeard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bclinkinbeard/subscriptions","organizations_url":"https://api.github.com/users/bclinkinbeard/orgs","repos_url":"https://api.github.com/users/bclinkinbeard/repos","events_url":"https://api.github.com/users/bclinkinbeard/events{/privacy}","received_events_url":"https://api.github.com/users/bclinkinbeard/received_events","type":"User","site_admin":false},"created_at":"2017-05-10T19:34:49Z","updated_at":"2017-05-10T19:34:49Z","body":"@mathisonian you mean make the `idyll()` function ALWAYS take an options object as the first parameter, and an optional callback as the second? And the options object would need to have either `inputPath` or `inputString` set?\r\n\r\nWould that mean the CLI would look like `idyll --inputPath index.idl`?"}}
{"actor":{"display_login":"bclinkinbeard"}}