chrisdiana / cms.js

Client-Side JavaScript Site Generator

Home Page:http://chrisdiana.github.io/cms.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CLI utility

shoostar opened this issue · comments

I'm not entirely sure how difficult this would be to create, or maybe it could just as easily be done as a .BAT file, but I think it'd be pretty cool to have some sort of simple script that if you did:

$ cmsjs new post 'Post Title Here'
-or-
$ cmsjs new page 'Page Title' pageTemplate

it would automatically create a new blank document in the appropriate folder (/posts or /pages), while also passing the appropriate variables into both the file name itself (if needed; posts would have the file creation date inserted) and into the front matter (pages would have a template defined).

Pages might be a little bit more difficult to set up properly, as you would probably want to include a way to insert a navigation item into the array in js/config.js, so maybe you could have something like:

$ cmsjs new page 'Page Title' pageTemplate navName targetWindow

...or use the page title as navName, and just drop that variable from the string above. targetWindow would be set as "blank" or "self", allowing navigation links to be opened in a new or same tab.

Anyways, I'm not sure how difficult something like this would be to implement, but it could be useful for people who expect to be doing a lot of publishing to their cms.js-powered site. I personally plan to use it to keep track of daily notes and logs of a project I'm working on. I don't require anything robust or feature-packed, just something quick, simple, and unobtrusive like cms.js.

In this issue, @ButuzGOL suggests porting cms.js to NPM. According to some reading I've been doing, CLI tools can also be created in Node.JS, which to me, makes the idea of a CLI tool for cms.js even more legit.

Thoughts?

Definitely on board. I like the idea of some CLI tools for CMS.js. I've been a little swamped for the past few weeks but I'm looking to get @ButuzGOL PR merged in soon.

Closing this and reopened as #81