【发布时间】:2023-03-22 09:25:01
【问题描述】:
我想为我的大多数项目使用一个配置。它在我的项目文件夹中搜索任何 sass、haml 或 coffee 文件夹。当我添加一个新的地方来制作 sass 文件时,我不想更新配置。
起始文件夹结构
- sass
- test.sass
- coffee
- test.coffee
- haml
- test.html.haml
- a
- folder
- somewhere
- deep
- sass
- test2.sass
- coffee
- test2.coffee
- haml
- test2.html.haml
- Guardfile
想要生成的文件和文件夹的文件夹结构:
- sass
- test.sass
- css
- test.css
- coffee
- test.coffee
- js
- test.js
- haml
- test.html.haml
- test.html
- a
- folder
- somewhere
- deep
- sass
- test2.sass
- css
- test2.css
- coffee
- test2.coffee
- js
- test2.js
- haml
- test2.html.haml
- test2.html
- Guardfile
到目前为止,haml 可以完美地与
guard :haml, input: 'haml' do
watch(/^.+(\.html\.haml)$/)
end
sass,coffeescript 在完全相同的代码下工作方式不同
guard :coffeescript, input: 'coffee', output: 'js' do
watch(/^.+(\.coffee)$/)
end
guard :sass, input: 'sass', output: 'css' do
watch(/^.+(\.sass)$/)
end
最终结果导致将目标 css 和 js 文件夹放置在项目文件夹的根目录中。即使我删除了output: 属性,它也会在根目录下创建一个coffee 和sass 文件夹。
结果文件夹结构
- sass
- test.sass
- css
- test.css
- test2.css
- coffee
- test.coffee
- js
- test.js
- test2.js
- haml
- test.html.haml
- test.html
- a
- folder
- somewhere
- deep
- sass
- test2.sass
- coffee
- test2.coffee
- haml
- test2.html.haml
- test2.html
- Guardfile
我不知道发生了什么,有人可以告诉我吗?
使用 Guard 版本 2.6.1
【问题讨论】:
标签: coffeescript sass haml guard