jeremyworboys / node-kit

Node based compiler for .kit files.
MIT License
15 stars 8 forks source link

Documentation for usage via the command line? #15

Closed MattWilcox closed 9 years ago

MattWilcox commented 9 years ago

Hello,

My apologies if this is a stupid question, I am just starting with npm and my intent is to replace my CodeKit usage. I've been following http://blog.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool/ and want to integrate node-kit instead of Jade.

I don't understand how to use node-kit from the command line to include as a script though. With jade, for example, I can do this:

"scripts": { "build:markup": "jade assets/markup/index.jade --obj assets.json -o dist" }

I'm struggling to find how the npm ecosystem documents such command line usage, and I can't figure out how to get something equivalent in node-kit.

Thanks, Matt

fatso83 commented 9 years ago

Hi, @MattWilcox . Building such a script just requires a few lines of code. Basically parse out the arguments and supply them to node-kit. But the quickest route is just to use another existing tool: pykitlangc.

Example : pykitlangc input.kit output.html

A project of mine, grunt-codekit, used to wrap that program earlier, before node-codekit was available. It is very fast and does a good job. Might not produce 100% identical output to this one or the reference, but that's just edge cases relating to newline handling.

fatso83 commented 9 years ago

I hacked it together for you :-) Just do this npm install -g fatso83/node-kit-cmd and build files like this node-kit imports.kit ut.html

For future reference, @MattWilcox, I would study the 10 lines of code I wrote to see how easy it is to cobble together a command line tool from existing libraries.

MattWilcox commented 9 years ago

Thanks! I'll give that a try :)

jeremyworboys commented 9 years ago

Hey @MattWilcox

There is no command line to node-kit, it is a standalone compiler for the Kit language.

The code @fatso83 has linked above should get you out of trouble.