如何阻止nanoc跳过内容页面
所以我建立了一个 nanoc 站点,一切都很顺利,唯一的问题是库中的一些数据几乎在每次编译时都会发生变化。当我输入
nanoc compile
Nanoc 时,它会跳过重新编译站点,因为它认为视图没有更改,但它已经更改,因为自上次编译以来,lib 中的变量已采用新值!
我尝试过查看 config.yaml,但看起来那里没有任何设置。我可以想出一些方法来破解这个问题,例如:
rm output/* && nanoc compile
但这看起来很黑客,并且会在重新编译每个页面时使网站瘫痪。或者我可以做一些类似的事情:
echo "\n" >> content/index.html && nanoc compile
但这让我内心受伤。我真正想要的是 --force-compile 标志或其他东西。
So I've set up a nanoc site and everything is going well, the only problem is that there is some data in a lib that changes on nearly every compile. When I type
nanoc compile
Nanoc skips recompiling the site because it thinks that the view has not changed, but it has because the variable in the lib has taken on a new value since the last compiling!
I've tried going through config.yaml, but it doesn't look like there are any settings there. I can think of some ways to hack this, for example:
rm output/* && nanoc compile
But that seems hackish and will keep the site down while it is recompiling each page. Or I could do something along the lines of this:
echo "\n" >> content/index.html && nanoc compile
But that hurts me inside. What I would really like is a --force-compile flag or something.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从 nanoc 3.2 开始,可以编写自定义命令。在站点目录中创建一个命令/目录并将命令放入其中。命令是使用 DSL 定义的,如下所示:
http:// /nanoc.stoneship.org/docs/5-advanced-concepts/#writing-commands
然后,您可以创建一个强制重新编译自定义命令,该命令仅删除您知道将要更改的库或文件。
As of nanoc 3.2, it is possible to write custom commands. Create a commands/ directory in your site directory and drop your commands there. A command is defined using a DSL and looks something like this:
http://nanoc.stoneship.org/docs/5-advanced-concepts/#writing-commands
Then you can create a force recompile custom command that just erases the lib or files you know are going to change.