Sphido logo

@sphido/core

Core contains most important getPage() and getPages() functions.

Basic page object looks like bellow:

{
  "file":"path to the file",
  "dir": " directory to the file",
  "base" : "file basename without extension",
  "content": "content of file"
}

Pages are merged inside getPage() function together with extenders. Extender can be object or function.

Install

yarn add @sphido/core

Example

import globby from 'globby';
import {getPages} from '@sphido/core';

(async () => {
  const pages = await getPages(
    await globby('content/**/*.{md,html}')
  );
})();

You can also process single page like follow:

import {getPage} from '@sphido/core';

(async () => {
  const page = await getPage('example.md');
})();

Source codes

https://github.com/sphido/sphido/tree/main/packages/sphido-core