mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-22 13:37:05 +02:00
fix: blog file should trigger reload
This commit is contained in:
parent
221023fd51
commit
dc1e417db8
4 changed files with 38 additions and 14 deletions
26
docs/docusaurus.md
Normal file
26
docs/docusaurus.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
id: docusaurus
|
||||
title: docusaurus
|
||||
---
|
||||
|
||||
<h1 align="center">
|
||||
<p align="center">Docusaurus</p>
|
||||
<a href="https://docusaurus.io"><img src="https://raw.githubusercontent.com/facebook/Docusaurus/master/website/static/img/slash-introducing.png" alt="Docusaurus"></a>
|
||||
</h1>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/package/docusaurus"><a href="#backers" alt="sponsors on Open Collective"><img src="https://opencollective.com/Docusaurus/backers/badge.svg" /></a> <a href="#sponsors" alt="Sponsors on Open Collective"><img src="https://opencollective.com/Docusaurus/sponsors/badge.svg" /></a> <img src="https://img.shields.io/npm/v/docusaurus.svg?style=flat" alt="npm version"></a>
|
||||
<a href="https://circleci.com/gh/facebook/Docusaurus"><img src="https://circleci.com/gh/facebook/Docusaurus.svg?style=shield" alt="CircleCI Status"></a>
|
||||
<a href="CONTRIBUTING.md#pull-requests"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome"></a>
|
||||
<a href="https://discord.gg/docusaurus"><img src="https://img.shields.io/badge/chat-on%20discord-7289da.svg" alt="Chat"></a>
|
||||
<a href="https://github.com/prettier/prettier"><img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square"></a>
|
||||
<a href="https://github.com/facebook/jest"><img src="https://img.shields.io/badge/tested_with-jest-99424f.svg" alt="Tested with Jest"></a>
|
||||
</p>
|
||||
|
||||
## Introduction
|
||||
|
||||
Docusaurus is a project for easily building, deploying, and maintaining open source project websites.
|
||||
|
||||
* **Simple to Start** Docusaurus is built to be easy to [get up and running](https://docusaurus.io/docs/en/installation.html) in as little time possible. We've built Docusaurus to handle the website build process so you can focus on your project.
|
||||
* **Localizable** Docusaurus ships with [localization support](https://docusaurus.io/docs/en/translation.html) via CrowdIn. Empower and grow your international community by translating your documentation.
|
||||
* **Customizable** While Docusaurus ships with the key pages and sections you need to get started, including a home page, a docs section, a [blog](https://docusaurus.io/docs/en/blog.html), and additional support pages, it is also [customizable](https://docusaurus.io/docs/en/custom-pages.html) as well to ensure you have a site that is [uniquely yours](https://docusaurus.io/docs/en/api-pages.html).
|
|
@ -1,6 +0,0 @@
|
|||
---
|
||||
id: intro
|
||||
title: Introducing Munseo
|
||||
---
|
||||
|
||||
Introducing Munseo :)
|
|
@ -31,10 +31,14 @@ module.exports = async function start(siteDir, cliOptions = {}) {
|
|||
console.error(chalk.red(err.stack));
|
||||
});
|
||||
};
|
||||
const fsWatcher = chokidar.watch(['../docs/**/*.md', 'siteConfig.js'], {
|
||||
cwd: siteDir,
|
||||
ignoreInitial: true
|
||||
});
|
||||
const docsRelativeDir = props.siteConfig.customDocsPath || 'docs';
|
||||
const fsWatcher = chokidar.watch(
|
||||
[`../${docsRelativeDir}/**/*.md`, 'blog/**/*.md', 'siteConfig.js'],
|
||||
{
|
||||
cwd: siteDir,
|
||||
ignoreInitial: true
|
||||
}
|
||||
);
|
||||
fsWatcher.on('add', reload);
|
||||
fsWatcher.on('change', reload);
|
||||
fsWatcher.on('unlink', reload);
|
||||
|
|
|
@ -22,14 +22,14 @@ function parse(fileString) {
|
|||
return {metadata, content};
|
||||
}
|
||||
|
||||
async function loadBlog(siteDir) {
|
||||
const blogFiles = await globby(['**/*.md', '!.munseo', '!node_modules'], {
|
||||
cwd: siteDir
|
||||
async function loadBlog(blogDir) {
|
||||
const blogFiles = await globby(['**/*.md'], {
|
||||
cwd: blogDir
|
||||
});
|
||||
|
||||
const blogDatas = await Promise.all(
|
||||
blogFiles.map(async file => {
|
||||
const filepath = path.resolve(siteDir, file);
|
||||
const filepath = path.resolve(blogDir, file);
|
||||
const fileString = await fs.readFile(filepath, 'utf-8');
|
||||
const {metadata, content} = parse(fileString);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue