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

Support custom build path #2410

Closed
joe223 opened this issue Mar 14, 2020 · 12 comments · Fixed by #2417
Closed

Support custom build path #2410

joe223 opened this issue Mar 14, 2020 · 12 comments · Fixed by #2417
Labels
difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. help wanted Asking for outside help and/or contributions to this particular issue or PR.

Comments

@joe223
Copy link

joe223 commented Mar 14, 2020

🚀 Feature

Add a new configuration of docusaurus output with default value build

Have you read the [Contributing Guidelines on issues]yes

Yes

Motivation

We can build static web site to specific directory directly with any other actions. That would be more convenient.

Pitch

Just likes:

// docusaurus.config.js
module.exports = {
  // ...
  output: '../docs' // default value: build

If we execute npm run build, the build assets are save at ../docs directory.

@joe223 joe223 added feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: needs triage This issue has not been triaged by maintainers labels Mar 14, 2020
@yangshun yangshun removed the status: needs triage This issue has not been triaged by maintainers label Mar 14, 2020
@yangshun
Copy link
Contributor

Sure, we don't mind accepting such a flag.

Alternatively, if you want to unblock yourself, you could also modify your package.json's build command and add a mv after it:

{
  "scripts": {
    "build": "docusaurus build && mv build <new directory>",
    ...
  },
  ...

@joe223
Copy link
Author

joe223 commented Mar 14, 2020

@yangshun Thanks for the advise, that is what I did so far. I don't need to ensure the new directory is empty in case the build command break off if we got output configuration. 😁

@yangshun
Copy link
Contributor

Ok then do docusaurus build && rm -rf <new directory> && mv build <new directory>

@joe223
Copy link
Author

joe223 commented Mar 14, 2020

Thanks again! @yangshun

@yangshun yangshun added help wanted Asking for outside help and/or contributions to this particular issue or PR. good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. labels Mar 15, 2020
@yangshun yangshun assigned 2timesjay and jsjoeio and unassigned 2timesjay Mar 15, 2020
@yangshun
Copy link
Contributor

@jsjoeio I heard from @JoelMarcey you would like to work on some ramp up tasks. Would you be interested in this?

@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 15, 2020

Hi @yangshun! That's right. This one sounds good to me, sure!

@cangSDARM
Copy link

Is it just not comprehensive enough in the build command? We want to change this output directory when running docusaurus start

@cangSDARM
Copy link

cangSDARM commented Feb 16, 2022

The static file directory doesn't seem to support relative directories either, which is needed in our project (a project that generates documentation dynamically, for our inc. internal documentary)

@hrumhurum
Copy link

The build command option does not cover the desired use case as we need to run npm run serve command as well and it should use the right build directory.

This means that the output directory should be specified in docusaurus.config.js file in order to be universally useful.

@jsjoeio jsjoeio removed their assignment Oct 4, 2022
@slorber
Copy link
Collaborator

slorber commented Oct 5, 2022

Both build/serve commands take an output dir option, and there's even a --build option on the serve command. We don't plan to add output dir to the config sorry

@ma5d
Copy link

ma5d commented Mar 30, 2024

构建命令选项不涵盖所需的用例,因为我们还需要运行npm run serve命令,并且它应该使用正确的构建目录。

这意味着应该在docusaurus.config.js文件中指定输出目录以便通用。

have you solven this problem?

@martian17
Copy link

martian17 commented Aug 12, 2024

Both build/serve commands take an output dir option, and there's even a --build option on the serve command. We don't plan to add output dir to the config sorry

Command option is prone to error, as you need to change each command carefully when you make changes to the out-dir. That's why we need a single place were the config is handled. In other libraries, configurations often mirror command line options, so it should be for docusaurus as well.

To add to this, config files should specify the default options, and command line options should be able to override the option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. help wanted Asking for outside help and/or contributions to this particular issue or PR.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants