docusaurus/docs/commands.html

8 lines
13 KiB
HTML
Raw Normal View History

2017-08-16 22:31:45 -04:00
<html><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1"/><title>CLI Commands · Docusaurus</title><meta name="viewport" content="width=device-width"/><meta property="og:title" content="CLI Commands · Docusaurus"/><meta property="og:type" content="website"/><meta property="og:url" content="https://docusaurus.io/index.html"/><meta property="og:description" content="Docusaurus provides a set of scripts to help you generate, serve, and deploy your website. These scripts can be invoked with the `run` command when using Yarn or npm. Some common commands are:"/><meta name="robots" content="noindex"/><link rel="shortcut icon" href="/img/docusaurus.ico"/><link rel="stylesheet" href="/css/main.css"/><script async="" defer="" src="https://buttons.github.io/buttons.js"></script></head><body class="sideNavVisible"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img src="/img/docusaurus.svg"/><h2>Docusaurus</h2></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-internal"><li><a href="/docs/installation.html" target="_self">Docs</a></li><li><a href="/en/help.html" target="_self">Help</a></li><li><a href="https://github.com/facebookexperimental/docusaurus" target="_self">GitHub</a></li></ul></nav></div></header></div></div><div class="navPusher"><div class="docMainWrapper wrapper"><div class="container docsNavContainer" id="docsNav"><nav class="toc"><div class="toggleNav"><section class="navWrapper wrapper"><div class="navBreadcrumb wrapper"><div class="navToggle" id="navToggler"><i></i></div><h2><i></i><span>API</span></h2></div><div class="navGroups"><div class="navGroup navGroupActive"><h3>Getting Started</h3><ul><li class="navListItem"><a class="navItem" href="/docs/installation.html#content">Installation</a></li><li class="navListItem"><a class="navItem" href="/docs/site-preparation.html#content">Site Preparation</a></li><li class="navListItem"><a class="navItem" href="/docs/site-creation.html#content">Creating your site</a></li></ul></div><div class="navGroup navGroupActive"><h3>Guides</h3><ul><li class="navListItem"><a class="navItem" href="/docs/custom-pages.html#content">Custom Pages</a></li><li class="navListItem"><a class="navItem" href="/docs/navigation.html#content">Navigation and Sidebars</a></li><li class="navListItem"><a class="navItem" href="/docs/blog.html#content">Adding a Blog</a></li><li class="navListItem"><a class="navItem" href="/docs/translation.html#content">Translations</a></li><li class="navListItem"><a class="navItem" href="/docs/search.html#content">Enabling Search</a></li><li class="navListItem"><a class="navItem" href="/docs/versioning.html#content">Versioning</a></li></ul></div><div class="navGroup navGroupActive"><h3>API</h3><ul><li class="navListItem navListItemActive"><a class="navItem navItemActive" href="/docs/commands.html#content">CLI Commands</a></li><li class="navListItem"><a class="navItem" href="/docs/api-pages.html#content">Pages and Styles</a></li><li class="navListItem"><a class="navItem" href="/docs/site-config.html#content">siteConfig.js</a></li><li class="navListItem"><a class="navItem" href="/docs/doc-markdown.html#content">Markdown Features</a></li></ul></div></div></section></div><script>
2017-08-16 20:37:54 -04:00
var toggler = document.getElementById('navToggler');
var nav = document.getElementById('docsNav');
toggler.onclick = function() {
nav.classList.toggle('docsSliderActive');
};
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebookexperimental/docusaurus/edit/master/docs/api-commands.md" target="_blank">Edit this Doc</a><h1>CLI Commands</h1></header><article><div><p>Docusaurus provides a set of scripts to help you generate, serve, and deploy your website. These scripts can be invoked with the <code>run</code> command when using Yarn or npm. Some common commands are:</p><ul><li><a href="/docs/commands.html#docusaurus-start-port-number" target=""><code>yarn run start</code></a>: build and serve the website from a local server</li><li><a href="/docs/commands.html#docusaurus-examples" target=""><code>yarn run examples</code></a>: create example configuration files</li></ul><h2><a class="anchor" name="running-from-the-command-line"></a>Running from the command line <a class="hash-link" href="#running-from-the-command-line">#</a></h2><p>The scripts can be run using either Yarn or npm. If you&#x27;ve already gone through our Getting Started guide, you may already be familiar with the <code>start</code> command. It&#x27;s the command that tells Docusaurus to run the <code>docusaurus-start</code> script which generates the site and starts up a server, and it&#x27;s usually invoked like so:</p><pre class="prism language-javascript">yarn run start</pre><p>The same script can be invoked using npm:</p><pre class="prism language-javascript">npm run start</pre><p>To run a particular script, just replace the <code>start</code> command in the examples above with the command associated with your script.</p><h2><a class="anchor" name="using-arguments"></a>Using arguments <a class="hash-link" href="#using-arguments">#</a></h2><p>Some commands support optional arguments. For example, to start a server on port 8080, you can specify the <code>--port</code> argument when running <code>start</code>:</p><pre class="prism language-javascript">yarn run start <span class="token operator">--</span>port <span class="token number">8080</span></pre><p>If you run Docusaurus using npm, you can still use the command line arguments by inserting a <code>--</code> between <code>npm run &lt;command&gt;</code> and the command arguments:</p><pre class="prism language-javascript">npm run start <span class="token operator">--</span> <span class="token operator">--</span>port <span class="token number">8080</span></pre><h2><a class="anchor" name="configuration"></a>Configuration <a class="hash-link" href="#configuration">#</a></h2><p>These scripts are set up under the <code>&quot;scripts&quot;</code> key in your <code>website/package.json</code> file as part of the installation process. If you need help setting them up again, please refer to the <a href="/docs/installation.html" target="">Installation guide</a>.</p><p>Docusaurus provides some default mappings to allow you to run commands following Node conventions. Instead of typing <code>docusaurus-start</code> every time, you can type <code>yarn run start</code> or <code>npm start</code> to achieve the same.</p><h2><a class="anchor" name="commands"></a>Commands <a class="hash-link" href="#commands">#</a></h2><ul><li><a href="#docusaurus-build" target=""><code>docusaurus-build</code></a></li><li><a href="#docusaurus-examples-feature" target=""><code>docusaurus-examples [feature]</code></a></li><li><a href="#docusaurus-publish" target=""><code>docusaurus-publish</code></a></li><li><a href="#docusaurus-rename-version-currentversion-newversion" target=""><code>docusaurus-rename-version &lt;currentVersion&gt; &lt;newVersion&gt;</code></a></li><li><a href="#docusaurus-start-port-number" target=""><code>docusaurus-start [--port &lt;number&gt;]</code></a></li><li><a href="#docusaurus-version-version" target=""><code>docusaurus-version &lt;version&gt;</code></a></li><li><a href="#docusaurus-write-translations" target=""><code>docusaurus-write-translations</code></a></li></ul><hr/><h2><a class="anchor" name="reference"></a>Reference <a class="hash-link"
/docs/installation.html">Getting Started</a></div><div><h5>Community</h5><a href="/en/users.html">User Showcase</a></div><div><h5>More</h5><a href="https://github.com/facebookexperimental/docusaurus">GitHub</a><a class="github-button" href="https://github.com/facebookexperimental/docusaurus" data-icon="octicon-star" data-count-href="/facebookexperimental/docusaurus/stargazers" data-count-api="/repos/facebookexperimental/docusaurus#stargazers_count" data-count-aria-label="# stargazers on GitHub" aria-label="Star this project on GitHub">Star</a></div></section><a href="https://code.facebook.com/projects/" target="_blank" class="fbOpenSource"><img src="/img/oss_logo.png" alt="Facebook Open Source" width="170" height="45"/></a><section class="copyright">Copyright © 2017 Facebook Inc.</section></footer></div></body></html>