Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

can you run blade just on the client? #166

Closed
nkhine opened this Issue Apr 17, 2013 · 4 comments

Comments

Projects
None yet
2 participants

nkhine commented Apr 17, 2013

hi,
is it possible to compile all the blade templates and host these on say gh-pages as a static type site?

@ghost ghost assigned bminer Apr 17, 2013

Owner

bminer commented Apr 17, 2013

No. The Blade compiler is designed exclusively for Node.js; however, with a few tweaks, it could run on the browser, I suppose. The parser is browser-compatible out-of-the-box, but the compiler uses Node libraries like path and fs along with the require() function.

@bminer bminer closed this Apr 17, 2013

Owner

bminer commented Apr 17, 2013

To answer your other question... "is it possible to compile all the blade templates and host these on say gh-pages as a static type site?"

Yes, you can compile templates with the Blade command-line tool and serve them as static files.

nkhine commented Apr 17, 2013

great! what would be the command line to compile these templates?
thanks

Owner

bminer commented Apr 17, 2013

Output of blade --help:


  Usage: blade [options] source_path destination_path

  Options:

    -h, --help                output usage information
    -V, --version             output the version number
    -R, --render              renders the template and outputs HTML (default)
    -C, --compile             compile-only: output the compiled template
    -l, --locals <str>        JSON string to be used as the locals object
    -L, --locals-file <file>  require() path to a module exporting locals obj
    -o, --compile-opts <str>  JSON string to be used as the compiler's options
    -d, --debug               sets the compiler's debug option
    -m, --minify              sets the compiler's minify option
    --no-include-source       clears the compiler's includeSource option

Renders or compiles Blade templates.

If a filename is `-` instead of an actual path, read from standard input or
write to standard output.
includeSource compiler option is set by default.

Examples:

        Render a Blade template to stdout from stdin using the local variables
        exported in a Node module (i.e. ./locals.js):
        $ blade -L ./locals - -

        Render a Blade template to stdout from stdin using the locals provided
        $ blade -l '{"author":"Blake Miner"}' - -

        Compile foo.blade and output the minified template to stdout:
        $ blade -C -m foo.blade -

        Compile and minify an entire directory of *.blade files:
        $ blade -C -m ./views ./public/views
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment