Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: plugin public files (close: #1491) #1494

Closed
wants to merge 12 commits into from
Closed

Conversation

shigma
Copy link
Collaborator

@shigma shigma commented Mar 30, 2019

Summary

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Build-related changes
  • Other, please describe:

If changing the UI of default theme, please provide the before/after screenshot:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)

You have tested in the following browsers: (Providing a detailed version will be better.)

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature
  • Related documents have been updated
  • Related tests have been updated

To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.

Motivation

See #1491

Usage

default usage

module.exports = {
  plugins: [
    // includes all files in `sourceDir`
    // ignore dotfiles and markdown
    '@vuepress/public-files',
  ],
}

an array of patterns

Based on #1493

module.exports = {
  plugins: [
    ['@vuepress/public-files', [
      '.vuepress/another-public',
      '.vuepress/one-more-public',
    ]]
  ],
}

object style of pattern

See: https://github.com/webpack-contrib/copy-webpack-plugin#patterns

module.exports = {
  plugins: [
    ['@vuepress/public-files', {
      from: '_assets', // i.e. docs/_assets
      to: 'assets', // i.e. dist/assets
      ignore: [/* globs */],
    }],
  ],
}

use multiple times

module.exports = {
  plugins: [
    ['@vuepress/public-files', [
      '.vuepress/another-public',
      '.vuepress/one-more-public',
    ]],
    ['@vuepress/public-files', {
      from: '_assets',
      to: 'assets',
      ignore: [/* globs */],
    }],
  ],
}

TODO

  • Implementation
  • Update docs
  • Update tests

@shigma
Copy link
Collaborator Author

shigma commented Mar 30, 2019

@ulivz Do you think this can be an official plugin? It is similar to @vuepress/plugin-register-components to a large extent.

@timaschew
Copy link
Contributor

@shigma awesome 🎉 it works 🙏🏼
I'm using this setup BTW:

module.exports = {
  plugins: [
    ['@vuepress/public-files', ['.']]
  ]
}

@shigma
Copy link
Collaborator Author

shigma commented Apr 1, 2019

@timaschew Also, the default option is equivalent to ['.'].

module.exports = {
  plugins: [
    '@vuepress/public-files'
    // equivalent to ['@vuepress/public-files', ['.']]
  ]
}

@timaschew
Copy link
Contributor

@shigma why you're not using git rebase?
All these merge commits from master are very noisy.

@shigma
Copy link
Collaborator Author

shigma commented Apr 3, 2019

Pending for #1515

@timaschew
Copy link
Contributor

Pending for #1515

So this can be continued now?
I could do it (adding tests and docs) if you need help.

Do you plant to have this plugin enabled by default?
If not just keep in mind that migrations from GitBook and other tools would not be possible out of the box.

@shigma
Copy link
Collaborator Author

shigma commented Apr 16, 2019

@timaschew tests have been added in another branch. There still exists some problems with our shared-utils.

@shigma shigma marked this pull request as ready for review April 28, 2019 07:43
@shigma
Copy link
Collaborator Author

shigma commented Apr 28, 2019

@ulivz Ready for review now 😆

@timaschew
Copy link
Contributor

Any updates for this?
I think this will really help people to migrate from other tools without moving their files.

@flozero
Copy link
Collaborator

flozero commented Sep 5, 2019

Hello all it's been a while since the pr was introduced i will make a review of the pr soon.

The problem is should it be add in the core or just in some libs of vuepress plugin you can add after.

@flozero flozero self-assigned this Sep 5, 2019
@flozero flozero added complexity: medium Medium complexity status: core team assigned Core team member assigned labels Sep 5, 2019
@flozero flozero added status: WIP Work in progress type: enhancement Request to enhance an existing feature version: 1.x Relates to version 1 of VuePress labels Sep 5, 2019
@meteorlxy meteorlxy closed this Jun 11, 2021
@meteorlxy meteorlxy deleted the plugin-public-files branch June 11, 2021 04:58
@calin-darie-evo-sapio
Copy link

What happened to the pull request? Is there an alternative now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: medium Medium complexity status: core team assigned Core team member assigned status: WIP Work in progress type: enhancement Request to enhance an existing feature version: 1.x Relates to version 1 of VuePress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants