Question

The wintersmith api documentation talks about :

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.

How do I print[ing] the content tree ? I would like to assume that I can do this via the cli.

Was it helpful?

Solution

There's no option to do it from the CLI without building. But this small script will do it:

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))
})

OTHER TIPS

The ContentTree is printed every time you build wintersmith using wintersmith build, so your assumption is correct. Look for rendering tree: and what follows after that. All of the files under /content will appear and show both the source file and the output files that result, including where they are in the directory structure.

Example output:

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: /)

In case you're curious, you can find the code that does this here: https://github.com/jnordberg/wintersmith/blob/master/src/core/renderer.coffee#L36

Regarding getPluginColor(), this is a function exposed on content plugins. You should see the source files print in cyan, which corresponds with the following line of code: https://github.com/jnordberg/wintersmith/blob/master/src/core/content.coffee#L60

Other content plugins can return a different color if they choose, which could enhance the visualization printed via the CLI.

I hope that helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top