Local Folder Source

The Local Folder Source is used to pull content from a folder located on the same machine as Mosaic is running.

It is common to use this source when running mosaic locally.

Installation

yarn add @jpmorganchase/mosaic-source-local-folder

Configuration

PropertyDescriptionRequired
modulePathThe path to the installed module (@jpmorganchase/mosaic-source-local-folder)Yes
namespaceThe scope for this sourceYes
disabledWhen true, content from this source is not usedNo
options.rootDirThe top level directory content will be pulled fromYes
options.prefixDirThe root path used in the content URLYes
options.extensionsCollection of file extensions that the source will look for inside the rootDirYes

Example Local Folder Source Definition

{
    modulePath: '@jpmorganchase/mosaic-source-local-folder',
    namespace: 'local', // each site has it's own namespace, think of this as your content's uid
    options: {
    rootDir: '../../docs', // relative path to content
    prefixDir: 'local', // root path used for namespace
    extensions: ['.mdx'] // extensions of content which should be pulled
    }
}

This source will look for content with the ".mdx" extension in a "docs" directory 2 levels up from the Mosaic working directory. That content is included in the "local" namespace and available from a route that is prefixed with "local".

So if you had a file, docs/app/index.mdx then you would be able to view it at http://localhost:3000/local/app/index.

Mosaic BETA

Coming soon