DocPad plugin for simple data files.
Loads and parses JSON, YAML, JavaScript, and CoffeeScript files from src/data/ and stores the contents on
config.templateData, which makes the data available as @filename (or {{filename}} or whatever) when rendering
documents and layouts.
Notable features:
Data is cached and only updated when the source file changes
Intelligent support for files with spaces, hyphens, etc. in the name (e.g. file-name.json becomes @fileName.)
Support for absolute folder paths
Installation
docpad install datafiles
Configuration
dataPaths: An array of folders to search for data files in.
Relative dataPaths are resolved from docpadConfig.srcPath, which defaults to ./src/.
camelCase: converts file names with spaces, hyphens, etc. to camelCase to enable easier usage in templates.
For example foo-bar.json becomes @fooBar when true vs @['foo-bar'] when false.
alwaysReload: Default behavior is to check the mtime and only reload modified files during regeneration.
When true, this check will be skipped and all files will always be reloaded.
Note that DocPad only watches for changes in folders under docpadConfig.srcPath.