Function
Static Public Summary | ||
public |
ApiService(reptar: *): * |
|
public |
addCollections(reptar: *) |
|
public |
async addDataFiles(reptar: *) |
|
public |
addTemplateFilter(env: Object, name: string, func: Function, async: boolean) Allow adding custom filters to the template engine. |
|
public |
async build(options: *) |
|
public |
async clean() |
|
public |
configureTemplateEngine(options: Object): Object Exposed method to configure template engine. |
|
public |
createChecksum(input: string): string Create checksum hash of input. |
|
public |
createCollection(name: *, collectionConfig: *, config: *, renderer: *): * |
|
public |
createMarkdownEngine(options: Object): Object Create our Markdown engine. |
|
public |
fileHasFrontmatter(filePath: string): Promise<boolean> This is a fast way to check if a file has frontmatter without reading all of its contents into memory. |
|
public |
futureDatesFilter(file: File, filterConfig: Object): boolean Future date filter. |
|
public |
async init() |
|
public |
metadataFilter(file: File, filterConfig: Object): boolean Metadata filter. |
|
public |
async new(args: *) |
|
public |
Parse a file with front matter. |
|
public |
Parse a YAML string into an object. |
|
public |
prunePrivateProperties(obj: Object, isPrivate: Function): Object Given an obj it'll prune any properites that start with |
|
public |
async readDataFiles(dataPath: string): Object Load all files in the given dataPath file and parse them into a JS object. |
|
public |
renderMarkdown(md: Object, str: string): string Render a piece of string from Markdown to HTML. |
|
public |
renderTemplate(env: Object, template: string, variables: object): string Render a template with given context variables. |
|
public |
renderTemplateString(env: Object, str: string, variables: object): string Render a string template with given context variables. |
|
public |
async serve() |
|
public |
Stringify an object to a YAML string. |
|
public |
Stringify a document. |
|
public |
async watch(options: {}) |
Static Public
public ApiService(reptar: *): * source
import {ApiService} from 'reptar/lib/server/api.js'
Params:
Name | Type | Attribute | Description |
reptar | * |
Return:
* |
public addCollections(reptar: *) source
import addCollections from 'reptar/lib/collection/index.js'
Params:
Name | Type | Attribute | Description |
reptar | * |
public async addDataFiles(reptar: *) source
import addDataFiles from 'reptar/lib/data-files.js'
Params:
Name | Type | Attribute | Description |
reptar | * |
public addTemplateFilter(env: Object, name: string, func: Function, async: boolean) source
import {addTemplateFilter} from 'reptar/lib/renderer/template.js'
Allow adding custom filters to the template engine.
See:
- http://mozilla.github.io/nunjucks/api#custom-filters
public async build(options: *) source
import build from 'reptar/lib/cli/build.js'
Params:
Name | Type | Attribute | Description |
options | * |
public configureTemplateEngine(options: Object): Object source
import {configureTemplateEngine} from 'reptar/lib/renderer/template.js'
Exposed method to configure template engine.
Params:
Name | Type | Attribute | Description |
options | Object | Options object with following properties: |
|
options.config | Object | Config object. |
|
options.paths | string | Array<string> | Either an array of paths or a singular path that we can load templates from. |
|
options.noCache | boolean | Whether our template engine should cache its templates. Only set to true when in watch mode. |
public createChecksum(input: string): string source
import createChecksum from 'reptar/lib/checksum.js'
Create checksum hash of input.
Params:
Name | Type | Attribute | Description |
input | string | Input to hash. |
Example:
'50de70409f11f87b430f248daaa94d67'
public createCollection(name: *, collectionConfig: *, config: *, renderer: *): * source
import {createCollection} from 'reptar/lib/collection/index.js'
Params:
Name | Type | Attribute | Description |
name | * | ||
collectionConfig | * | ||
config | * | ||
renderer | * |
Return:
* |
public createMarkdownEngine(options: Object): Object source
import {createMarkdownEngine} from 'reptar/lib/renderer/markdown.js'
Create our Markdown engine.
Params:
Name | Type | Attribute | Description |
options | Object | Configuration object. |
public fileHasFrontmatter(filePath: string): Promise<boolean> source
import {fileHasFrontmatter} from 'reptar/lib/parse/front-matter.js'
This is a fast way to check if a file has frontmatter without reading all of its contents into memory.
Params:
Name | Type | Attribute | Description |
filePath | string | Path to file on the file system. |
public futureDatesFilter(file: File, filterConfig: Object): boolean source
import futureDatesFilter from 'reptar/lib/filter/future-date.js'
Future date filter. Checks if a file's date occurs in the future.
public metadataFilter(file: File, filterConfig: Object): boolean source
import metadataFilter from 'reptar/lib/filter/metadata.js'
Metadata filter. Checks if a file.data object matches all the configured filter options.
Example:
let filterConfig = {
draft: true
};
file.data = {
title: 'foo',
draft: true
};
metadataFilter(filterConfig, file); // true
public async new(args: *) source
import new from 'reptar/lib/cli/new.js'
Params:
Name | Type | Attribute | Description |
args | * |
public parse(str: string, options: Object): JSON source
import {parse} from 'reptar/lib/parse/front-matter.js'
Parse a file with front matter.
public parse(str: string): Object source
import {parse} from 'reptar/lib/parse/yaml.js'
Parse a YAML string into an object.
Params:
Name | Type | Attribute | Description |
str | string | String containing YAML information. |
public prunePrivateProperties(obj: Object, isPrivate: Function): Object source
import prunePrivateProperties from 'reptar/lib/server/prune-private-properties.js'
Given an obj it'll prune any properites that start with _
.
public async readDataFiles(dataPath: string): Object source
import {readDataFiles} from 'reptar/lib/data-files.js'
Load all files in the given dataPath file and parse them into a JS object. Then depending on the directory path structure and the name of the file set the files contents in that path on an object.
Params:
Name | Type | Attribute | Description |
dataPath | string | Path to data files. |
public renderMarkdown(md: Object, str: string): string source
import {renderMarkdown} from 'reptar/lib/renderer/markdown.js'
Render a piece of string from Markdown to HTML.
public renderTemplate(env: Object, template: string, variables: object): string source
import {renderTemplate} from 'reptar/lib/renderer/template.js'
Render a template with given context variables.
public renderTemplateString(env: Object, str: string, variables: object): string source
import {renderTemplateString} from 'reptar/lib/renderer/template.js'
Render a string template with given context variables.
public stringify(obj: Object): string source
import {stringify} from 'reptar/lib/parse/yaml.js'
Stringify an object to a YAML string.
Params:
Name | Type | Attribute | Description |
obj | Object | JavaScript object. |
public stringify(str: string, data: Object): string source
import {stringify} from 'reptar/lib/parse/front-matter.js'
Stringify a document.
public async watch(options: {}) source
import watch from 'reptar/lib/cli/watch.js'
Params:
Name | Type | Attribute | Description |
options | {} |
|