Frage

I'm developing on an old operating system that can't run a perquisite version of Node.js for using Jade. However, I think it can install pyjade.

Can I use pyjade on the command line to convert files the same way I can use jade? If so, how?

War es hilfreich?

Lösung

Yes, PyJade comes with a command line utility (CLI). Like most all *nix-style CLI programs, help can be printed with the -h flag:

$> pyjade -h
Usage: pyjade [options] file [output]

Options:
  -h, --help                 Show this help message and exit
   -o FILE, --output=FILE    Write output to FILE
   -c COMPILER,              Output COMPILER to use. Must be one of:
                                mako,tornado,jinja,underscore,django
                                (default is django)
   -e FILE, --ext=FILE       Set import/extends default file extension

So, to output a Jinja2 template, you could do the following:

$> pyjade -c jinja input_file.jade > /pipe/output/to/file_path.html

Note that you will still need to use the appropriate PyJade extension in your web framework to fully display the template in its final form.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top