wintersmith api文档谈到:
getPluginColor() Return vanity color used to identify the plugin when printing the content tree choices are: bold, italic, underline, inverse, yellow, cyan, white, magenta, green, red, grey, blue, rainbow, zebra or none.
我该怎么做print[ing] the content tree?我想假设我可以通过cli做到这一点。
发布于 2015-12-11 16:36:00
在没有构建的情况下,无法从CLI中选择这样做。但是这个小脚本就能做到:
var wintersmith = require('wintersmith')
var env = wintersmith('/path/to/your/projects/config.json')
env.load(function(error, result) {
console.log(wintersmith.ContentTree.inspect(result.contents))
})发布于 2014-02-08 07:25:53
每次使用ContentTree构建wintersmith时都会打印wintersmith build,因此您的假设是正确的。查找rendering tree:及其后面的内容。/content下的所有文件都将显示并显示源文件和结果输出文件,包括它们在目录结构中的位置。
示例输出:
rendering tree:
articles/
another-test/
index.md (url: /articles/another-test/)
bamboo-cutter/
index.md (url: /articles/bamboo-cutter/)
taketori_monogatari.jpg (url: /articles/bamboo-cutter/taketori_monogatari.jpg)
hello-world/
index.md (url: /articles/hello-world/)
markdown-syntax/
index.md (url: /articles/markdown-syntax/)
red-herring/
banana.png (url: /articles/red-herring/banana.png)
index.md (url: /articles/red-herring/)
test.md (url: /articles/test.html)
authors/
baker.json (url: /authors/baker.html)
the-wintersmith.json (url: /authors/the-wintersmith.html)
css/
main.css (url: /css/main.css)
posts/
test.md (url: /posts/test.html)
.DS_Store (url: /.DS_Store)
about.md (url: /about.html)
archive.json (url: /archive.html)
feed.json (url: /feed.xml)
index.json (url: /)如果您好奇,您可以在这里找到这样做的代码:https://github.com/jnordberg/wintersmith/blob/master/src/core/renderer.coffee#L36
关于getPluginColor(),这是一个在内容插件上公开的函数。您应该看到用cyan打印的源文件,它与下面的代码行相对应:https://github.com/jnordberg/wintersmith/blob/master/src/core/content.coffee#L60
其他内容插件可以返回一个不同的颜色,如果他们选择,这可以增强可视化打印通过CLI。
我希望这能帮上忙!
https://stackoverflow.com/questions/21207294
复制相似问题