我在运行pug
pug src -out web --手表
如果我有
src/
index.pug
includes/
scripts.pug
web/
index.html (generated)在index.pug:include includes/scripts.pug中
使用这个设置--如果我修改了scripts.pug --它会生成我不需要的、也不想要的web/include/scripts.html,以便保持整洁。
是否有办法避免某些文件/目录的编译?(目前,解决方案是以html形式提供包含,但可能有一种方法)
发布于 2019-12-13 18:20:24
在文件中添加下划线前缀应该告诉Pug不要直接编译它们。这对于只用于包含的文件是非常有用的。
所以您应该将scripts.pug重命名为_scripts.pug
src/
index.pug
includes/
_scripts.pug
web/
index.html (generated)然后将include语句在index.pug中重写为:include includes/_scripts.pug
发布于 2022-03-10 22:27:09
帕格-克莱不知道如何不编译某些文件。就像前面的答案提到的那样,它确实适用于狼吞虎咽,但不适用于pug。我认为不编译、包含或扩展文件的唯一方法是将这些文件放在一个单独的根目录中。例如:
src/
templates/
views/
index.pug
includes/
scripts.pug
web/
index.html (generated)然后将pug设置为只编译视图目录。
pug -w src/templates/views/ -o web/ -Phttps://stackoverflow.com/questions/59324718
复制相似问题