mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +02:00
feat: add --no-minify flag to docusaurus start (#7452)
* feat: Adding --no-minify flag to start * Undoing the changes to old docs Co-authored-by: Lane Goolsby <lanegoolsby@rocketmortgage.com>
This commit is contained in:
parent
ba0d94d02b
commit
5aaa33fc61
3 changed files with 34 additions and 25 deletions
|
@ -126,6 +126,10 @@ cli
|
||||||
'--poll [interval]',
|
'--poll [interval]',
|
||||||
'use polling rather than watching for reload (default: false). Can specify a poll interval in milliseconds',
|
'use polling rather than watching for reload (default: false). Can specify a poll interval in milliseconds',
|
||||||
)
|
)
|
||||||
|
.option(
|
||||||
|
'--no-minify',
|
||||||
|
'build website without minimizing JS bundles (default: false)',
|
||||||
|
)
|
||||||
.action(async (siteDir, options) =>
|
.action(async (siteDir, options) =>
|
||||||
start(await resolveDir(siteDir), options),
|
start(await resolveDir(siteDir), options),
|
||||||
);
|
);
|
||||||
|
|
|
@ -32,6 +32,7 @@ export type StartCLIOptions = HostPortOptions &
|
||||||
hotOnly?: boolean;
|
hotOnly?: boolean;
|
||||||
open?: boolean;
|
open?: boolean;
|
||||||
poll?: boolean | number;
|
poll?: boolean | number;
|
||||||
|
minify?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function start(
|
export async function start(
|
||||||
|
@ -121,32 +122,35 @@ export async function start(
|
||||||
fsWatcher.on(event, reload),
|
fsWatcher.on(event, reload),
|
||||||
);
|
);
|
||||||
|
|
||||||
let config: webpack.Configuration = merge(await createClientConfig(props), {
|
let config: webpack.Configuration = merge(
|
||||||
watchOptions: {
|
await createClientConfig(props, cliOptions.minify),
|
||||||
ignored: /node_modules\/(?!@docusaurus)/,
|
{
|
||||||
poll: cliOptions.poll,
|
watchOptions: {
|
||||||
|
ignored: /node_modules\/(?!@docusaurus)/,
|
||||||
|
poll: cliOptions.poll,
|
||||||
|
},
|
||||||
|
infrastructureLogging: {
|
||||||
|
// Reduce log verbosity, see https://github.com/facebook/docusaurus/pull/5420#issuecomment-906613105
|
||||||
|
level: 'warn',
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
// Generates an `index.html` file with the <script> injected.
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
template: path.join(
|
||||||
|
__dirname,
|
||||||
|
'../webpack/templates/index.html.template.ejs',
|
||||||
|
),
|
||||||
|
// So we can define the position where the scripts are injected.
|
||||||
|
inject: false,
|
||||||
|
filename: 'index.html',
|
||||||
|
title: siteConfig.title,
|
||||||
|
headTags,
|
||||||
|
preBodyTags,
|
||||||
|
postBodyTags,
|
||||||
|
}),
|
||||||
|
],
|
||||||
},
|
},
|
||||||
infrastructureLogging: {
|
);
|
||||||
// Reduce log verbosity, see https://github.com/facebook/docusaurus/pull/5420#issuecomment-906613105
|
|
||||||
level: 'warn',
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
// Generates an `index.html` file with the <script> injected.
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
template: path.join(
|
|
||||||
__dirname,
|
|
||||||
'../webpack/templates/index.html.template.ejs',
|
|
||||||
),
|
|
||||||
// So we can define the position where the scripts are injected.
|
|
||||||
inject: false,
|
|
||||||
filename: 'index.html',
|
|
||||||
title: siteConfig.title,
|
|
||||||
headTags,
|
|
||||||
preBodyTags,
|
|
||||||
postBodyTags,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
// Plugin Lifecycle - configureWebpack and configurePostCss.
|
// Plugin Lifecycle - configureWebpack and configurePostCss.
|
||||||
plugins.forEach((plugin) => {
|
plugins.forEach((plugin) => {
|
||||||
|
|
|
@ -43,6 +43,7 @@ Builds and serves a preview of your site locally with [Webpack Dev Server](https
|
||||||
| `--no-open` | `false` | Do not open automatically the page in the browser. |
|
| `--no-open` | `false` | Do not open automatically the page in the browser. |
|
||||||
| `--config` | `undefined` | Path to docusaurus config file, default to `[siteDir]/docusaurus.config.js` |
|
| `--config` | `undefined` | Path to docusaurus config file, default to `[siteDir]/docusaurus.config.js` |
|
||||||
| `--poll [optionalIntervalMs]` | `false` | Use polling of files rather than watching for live reload as a fallback in environments where watching doesn't work. More information [here](https://webpack.js.org/configuration/watch/#watchoptionspoll). |
|
| `--poll [optionalIntervalMs]` | `false` | Use polling of files rather than watching for live reload as a fallback in environments where watching doesn't work. More information [here](https://webpack.js.org/configuration/watch/#watchoptionspoll). |
|
||||||
|
| `--no-minify` | `false` | Build website without minimizing JS/CSS bundles. |
|
||||||
|
|
||||||
:::important
|
:::important
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue