Publishing
After you’ve configured your site, you can publish it by calling the publish()
method. Doxicity
will process your markdown files, run your plugins, and output your website to the destination folder you’ve
configured.
import Doxicity from 'doxicity';
const dox = new Doxicity({
//
// your config here...
//
});
// Publish it
dox
.publish()
.then(result => {
console.log(
`\n` +
`Pages published: ${result.pages.length}\n` +
`Assets copied: ${result.assets.length}\n` +
`Time to publish: ${result.timeToPublish}ms\n` +
`Time to copy assets: ${result.timeToCopyAssets}ms\n`
);
})
.catch(err => {
console.log(err.message);
});
The publish()
method returns a Promise that resolves with a
DoxicityPublishResult
object. This object contains an array of
DoxicityPage
objects of pages that were published, an array of assets that were copied, and
some additional data about the operation.
Error Handling
If an error occurs, it will be an instance of the appropriate error type
as defined in the source. If you don’t care about handling specific error types, you can simply log err.message
to get
a human-readable description of the error.
TODO - list all errors here (help wanted!)