vuejs / vuepress

📝 Minimalistic Vue-powered static site generator
https://vuepress.vuejs.org
MIT License
22.48k stars 4.78k forks source link

Ignore some markdown files in source directory? #1558

Open JimmyVV opened 5 years ago

JimmyVV commented 5 years ago

Feature request

In my project, I am upgrade project from gitbook to vuepress, and I find that some stale files are being add .unused.md suffix. and I finish a summay-plugin to provide sidebars like gitbooks. The summary-plugin will parse SUMMARY.md, and it is useless for vuepress.

What problem does this feature solve?

to provide a plugin API, developers could ignore some useless markdown files.

    const patterns = ['**/*.md', '**/*.vue', '!.vuepress', '!node_modules']
    if (this.siteConfig.dest) {
      // #654 exclude dest folder when dest dir was set in
      // sourceDir but not in '.vuepress'
      const outDirRelative = path.relative(this.sourceDir, this.outDir)
      if (!outDirRelative.includes('..')) {
        patterns.push('!' + outDirRelative)
      }
    }
    const pageFiles = sort(await globby(patterns, { cwd: this.sourceDir }))

How should this be implemented in your opinion?

Are you willing to work on this yourself?

ok

liyangworld commented 4 years ago

I need this feature too

haimich commented 4 years ago

Today I wondered why the build of my Vuepress site takes so long. As it turns out Vuepress is compiling all the readme files of my PHP dependencies which are located in the vendor directory.

Vuepress is so nice to use because it works with config conventions but it would be even nicer to exclude folders :smile:

fsworld009 commented 3 years ago

There is config.patterns https://vuepress.vuejs.org/config/#patterns and you can ignore folders by prefixing ! in the pattern:

patterns: ['**/*.md', '**/*.vue', '!some_folder/**'],

I suppose you can make it ignore .unused as well

patterns: ['**/*.md', '**/*.vue', '!**/*.unused.md'],