alexluke / grunt-haml-php
此包已被弃用且不再维护。未建议替代包。
使用MtHaml处理HAML模板,MtHaml是Haml的PHP版本。
0.1.0
2013-11-14 19:06 UTC
Requires
- mthaml/mthaml: ~1.3
This package is not auto-updated.
Last update: 2021-08-30 11:30:54 UTC
README
使用MtHaml处理HAML模板,MtHaml是Haml的PHP版本。
入门
此插件需要Grunt ~0.4.1
如果您之前没有使用过 Grunt,请务必查看 入门指南,因为它解释了如何创建 Gruntfile 以及安装和使用Grunt插件。熟悉此过程后,您可以使用此命令安装此插件
npm install grunt-haml-php --save-dev
插件安装完成后,您可以使用以下JavaScript代码在Gruntfile中启用它
grunt.loadNpmTasks('grunt-haml-php');
"haml"任务
此插件需要composer来安装PHP依赖项。在安装此插件之前,请遵循安装说明。
概述
在您的项目Gruntfile中,向传递给grunt.initConfig()
的数据对象中添加名为haml
的部分。
grunt.initConfig({ haml: { options: { // Task-specific options go here. }, your_target: { // Target-specific file lists and/or options go here. }, }, })
选项
options.target
类型:String
默认值:php
设置MtHaml生成的目标输出。有效选项是php
和twig
。
options.writeError
类型:Boolean
默认值:true
如果启用,将编译错误写入输出文件。否则不执行任何操作。
options.enableDynamicAttributes
类型:Boolean
默认值:true
控制MtHaml的enable_dynamic_attrs
选项。禁用此选项将移除对MtHaml运行时的要求。
使用示例
简单的文件映射
grunt.initConfig({ haml: { compile: { files: { 'dest/file1.html': ['src/file1.haml'], }, }, }, })
所有haml文件
此示例编译了目录中的所有haml文件,并添加了php扩展。
grunt.initConfig({ haml: { compile: { files: [{ expand: true, src: ['src/templates/**/*.haml'], dest: 'dest/templates', ext: '.php' }], }, }, })
贡献
在没有正式风格指南的情况下,请务必保持现有的编码风格。为任何新的或更改的功能添加单元测试。使用Grunt检查和测试您的代码。
发布历史
- 2013年12月9日 - v0.2.1 - 捕获所有PHP错误,无论系统设置如何
- 2013年11月20日 - v0.2.0 - 添加将错误写入输出文件的选项
- 2013年11月14日 - v0.1.0 - 初次发布。