robwierzbowski / generator-jekyllrb

Supercharge Jekyll development with Yeoman. Yo, Jekyllrb!
BSD 3-Clause "New" or "Revised" License
596 stars 65 forks source link

Using values from the _config.yml #13

Closed robwierzbowski closed 11 years ago

robwierzbowski commented 11 years ago

We can load the _config.yml as a json object in the gruntfile with js-yaml and the following code:

grunt = require('grunt');
var jekyllConfig = require("js-yaml").safeLoad(grunt.file.read('_config.yml'));
console.log(jekyllConfig); // Prints _config.yml, jsonified

I initially wanted this to load the value of keep_files into an exclude list in the Grunt clean task, but there are a couple of shortcomings to this approach:

  1. Only reads the actual values in the _config.yml. Doesn't know anything about Jekyll defaults.
  2. Doesn't know about multiple configuration files listed in the Grunt task.
  3. Doesn't know about config files added programmatically in plugins like Jekyll Picture Tag.

Not sure if there's a benefit > work + complexity solution to this.

robwierzbowski commented 11 years ago

For now I don't see this as having a lot of utility.