【问题标题】:Use PyJade on Command-Line Like Jade像 Jade 一样在命令行上使用 PyJade
【发布时间】:2013-05-29 18:47:59
【问题描述】:

我正在一个旧操作系统上进行开发,该操作系统无法运行用于使用 Jade 的 Node.js 的额外版本。但是,我认为它可以安装pyjade。

能否像使用jade 一样在命令行上使用pyjade 来转换文件?如果有,怎么做?

【问题讨论】:

    标签: pug pyjade


    【解决方案1】:

    是的,PyJade 带有一个命令行实用程序 (CLI)。像大多数 *nix 风格的 CLI 程序一样,可以使用 -h 标志打印帮助:

    $> 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
    

    因此,要输出 Jinja2 模板,您可以执行以下操作:

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

    请注意,您仍然需要在 Web 框架中使用适当的 PyJade 扩展,才能以最终形式完全显示模板。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-12-03
      • 2011-05-30
      • 1970-01-01
      • 1970-01-01
      • 2011-11-25
      • 1970-01-01
      • 2015-05-19
      相关资源
      最近更新 更多