- Notifications
You must be signed in to change notification settings - Fork2
PXLbros/LightnCandy-CLI
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
LightnCandy-CLI is a CLI wrapper around the PHP implementation of mustache/handlebarsLightnCandy. This CLI tool can be used in your build process to compile mustache/handlebars templates to PHP to be used with the LightnCandy library or on their own.
LightnCandy-CLI is meant to be used as a CLI tool and can be globally installed with composer like so:composer global require pxlbros/lightncandy-cli
Make sure you have~/.composer/vendor/bin/
in your path.
You can also install LightnCandy-CLI into your project directory and run it straight from the vendor folder if you want to.
The first and only unamed argument is a path to the template file that you wish to compile.
$ lightncandy path/to/template.hbs
If omitted, LightnCandy-CLI will use STDIN as the template. This is usefull because you can pipe input into the utility.
$ echo 'Hello {{name}}!' | lightncandy
By default LightnCandy-CLI will pipe the compiled template to STDOUT but you can also write the output to disk by providing a path.
$ lightncandy path/to/template.hbs -o path/to/output.php
LightnCandy supports many flags that can be used to configure how it compiles your templates. A list of these options and what they do can be found on the page for theLightnCandy library. You can toggle them like so:
$ lightncandy path/to/template.hbs --FLAG_BARE --FLAG_HANDLEBARSJS
You can also use$ lightncandy --help
to see a list of availible options and their descriptions in your command line.
-b/--basedir "path/to/partials/directory/ path/to/different/dir"
Space seperted list of directory paths containing partial templates.
-p/--helpers "path/to/helpers/directory/ path/to/different/dir"
Space seperated list of directory paths containing helper functions.
-k/--blockhelpers "path/to/blockhelpers/directory/ path/to/different/dir"
Space seperated list of directory paths containing block helper functions.
-h/--hbhelpers "path/to/hbhelpers/directory/ path/to/different/dir"
Space seperated list of directory paths containing handlebars style helper functions.
-e/--fileext ".tmpl .partial"
Space seperated list of file extensions for template files.
-r/--render
If provided, will run the compiled template and will output the result instead.
-d/--data
JSON string to pass to the rendering function if the render flag is provided.
-c/--compress
Compress the output to reduce file size by around 30%.
About
CLI Wrapper for the PHP Library LightnCandy
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.