Skip to content

Commit

Permalink
Try to fix docs formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Dec 2, 2019
1 parent f489472 commit 6e92e52
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 42 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -44,21 +44,21 @@ For browsers:

```bash
# compile to a <script> containing a self-executing function
$ rollup main.js --format iife --name "myBundle" --file bundle.js
rollup main.js --format iife --name "myBundle" --file bundle.js
```

For Node.js:

```bash
# compile to a CommonJS module
$ rollup main.js --format cjs --file bundle.js
rollup main.js --format cjs --file bundle.js
```

For both browsers and Node.js:

```bash
# UMD format requires a bundle name
$ rollup main.js --format umd --name "myBundle" --file bundle.js
rollup main.js --format umd --name "myBundle" --file bundle.js
```

## Why
Expand Down
14 changes: 7 additions & 7 deletions docs/00-introduction.md
Expand Up @@ -8,7 +8,7 @@ Rollup is a module bundler for JavaScript which compiles small pieces of code in

### Installation

```console
```
npm install --global rollup
```

Expand All @@ -24,23 +24,23 @@ These commands assume the entry point to your application is named `main.js`, an

For browsers:

```console
```
# compile to a <script> containing a self-executing function ('iife')
$ rollup main.js --file bundle.js --format iife
rollup main.js --file bundle.js --format iife
```

For Node.js:

```console
```
# compile to a CommonJS module ('cjs')
$ rollup main.js --file bundle.js --format cjs
rollup main.js --file bundle.js --format cjs
```

For both browsers and Node.js:

```console
```
# UMD format requires a bundle name
$ rollup main.js --file bundle.js --format umd --name "myBundle"
rollup main.js --file bundle.js --format umd --name "myBundle"
```

### The Why
Expand Down
10 changes: 5 additions & 5 deletions docs/01-command-line-reference.md
Expand Up @@ -159,15 +159,15 @@ You *must* use a configuration file in order to do any of the following:

To use Rollup with a configuration file, pass the `--config` or `-c` flags.

```console
```
# use Rollup with a rollup.config.js file
$ rollup --config
rollup --config
# alternatively, specify a custom config file location
$ rollup --config my.config.js
rollup --config my.config.js
# .js and .mjs are supported
$ rollup --config my.config.mjs
rollup --config my.config.mjs
```

You can also export a function that returns any of the above configuration formats. This function will be passed the current command line arguments so that you can dynamically adapt your configuration to respect e.g. [`--silent`](guide/en/#--silent). You can even define your own command line options if you prefix them with `config`:
Expand Down Expand Up @@ -301,7 +301,7 @@ will set `process.env.INCLUDE_DEPS === 'true'` and `process.env.BUILD === 'produ

If you call this script via:

```console
```
npm run build -- --environment BUILD:development
```

Expand Down
42 changes: 21 additions & 21 deletions docs/04-tutorial.md
Expand Up @@ -8,22 +8,22 @@ title: Tutorial

The easiest way to use Rollup is via the Command Line Interface (or CLI). For now, we'll install it globally (later on we'll learn how to install it locally to your project so that your build process is portable, but don't worry about that yet). Type this into the command line:

```console
```
npm install rollup --global
# or `npm i rollup -g` for short
```

You can now run the `rollup` command. Try it!

```console
```
rollup
```

Because no arguments were passed, Rollup prints usage instructions. This is the same as running `rollup --help`, or `rollup -h`.

Let's create a simple project:

```console
```
mkdir -p my-rollup-project/src
cd my-rollup-project
```
Expand All @@ -47,7 +47,7 @@ export default 'hello world!';

Now we're ready to create a bundle:

```console
```
rollup src/main.js -f cjs
```

Expand All @@ -67,15 +67,15 @@ module.exports = main;

You can save the bundle as a file like so:

```console
```
rollup src/main.js -o bundle.js -f cjs
```

(You could also do `rollup src/main.js -f cjs > bundle.js`, but as we'll see later, this is less flexible if you're generating sourcemaps.)

Try running the code:

```console
```
node
> var myBundle = require('./bundle.js');
> myBundle();
Expand Down Expand Up @@ -107,22 +107,22 @@ export default {

To use the config file, we use the `--config` or `-c` flag:

```console
```
rm bundle.js # so we can check the command works!
rollup -c
```

You can override any of the options in the config file with the equivalent command line options:

```console
```
rollup -c -o bundle-2.js # `-o` is equivalent to `--file` (formerly "output")
```

_Note: Rollup itself processes the config file, which is why we're able to use `export default` syntax – the code isn't being transpiled with Babel or anything similar, so you can only use ES2015 features that are supported in the version of Node.js that you're running._

You can, if you like, specify a different config file from the default `rollup.config.js`:

```console
```
rollup --config rollup.config.dev.js
rollup --config rollup.config.prod.js
```
Expand All @@ -133,25 +133,25 @@ When working within teams or distributed environments it can be wise to add Roll

To install Rollup locally with NPM:

```console
```
npm install rollup --save-dev
```

Or with Yarn:

```console
```
yarn -D add rollup
```

After installing, Rollup can be run within the root directory of your project:

```console
```
npx rollup --config
```

Or with Yarn:

```console
```
yarn rollup --config
```

Expand Down Expand Up @@ -189,7 +189,7 @@ Create a file in the project root called `package.json`, and add the following c

Install rollup-plugin-json as a development dependency:

```console
```
npm install --save-dev rollup-plugin-json
```

Expand Down Expand Up @@ -244,7 +244,7 @@ Some plugins can also be applied specifically to some outputs. See [plugin hooks

Let us extend the previous example to provide a minified build together with the non-minified one. To that end, we install `rollup-plugin-terser`:

```console
```
npm install --save-dev rollup-plugin-terser
```

Expand Down Expand Up @@ -293,15 +293,15 @@ export default function () {

Rollup will use the dynamic import to create a separate chunk that is only loaded on demand. In order for Rollup to know where to place the second chunk, instead of passing the `--file` option we set a folder to output to with the `--dir` option:

```console
```
rollup src/main.js -f cjs -d dist
```

This will create a folder `dist` containing two files, `main.js` and `chunk-[hash].js`, where `[hash]` is a content based hash string. You can supply your own naming patterns by specifying the [`output.chunkFileNames`](guide/en/#outputchunkfilenames) and [`output.entryFileNames`](guide/en/#outputentryfilenames) options.

You can still run your code as before with the same output, albeit a little slower as loading and parsing of `./foo.js` will only commence once we call the exported function for the first time.

```console
```
node -e "require('./dist/main.js')()"
```

Expand Down Expand Up @@ -339,7 +339,7 @@ export default function () {

If we supply both entry points to rollup, three chunks are created:

```console
```
rollup src/main.js src/main2.js -f cjs
```

Expand Down Expand Up @@ -380,7 +380,7 @@ You can build the same code for the browser via native ES modules, an AMD loader

For example, with `-f esm` for native modules:

```console
```
rollup src/main.js src/main2.js -f esm -d dist
```

Expand All @@ -394,13 +394,13 @@ rollup src/main.js src/main2.js -f esm -d dist

Or alternatively, for SystemJS with `-f system`:

```console
```
rollup src/main.js src/main2.js -f system -d dist
```

Install SystemJS via

```console
```
npm install --save-dev systemjs
```

Expand Down
10 changes: 5 additions & 5 deletions docs/07-tools.md
Expand Up @@ -8,7 +8,7 @@ At some point, it's likely that your project will depend on packages installed f

Let's add a simple dependency called [the-answer](https://www.npmjs.com/package/the-answer), which exports the answer to the question of life, the universe and everything:

```console
```
npm install the-answer
# or `npm i the-answer`
```
Expand All @@ -26,7 +26,7 @@ export default function () {

…and run Rollup…

```console
```
npm run build
```

Expand All @@ -45,7 +45,7 @@ The resulting `bundle.js` will still work in Node.js, because the `import` decla

The [rollup-plugin-node-resolve](https://github.com/rollup/rollup-plugin-node-resolve) plugin teaches Rollup how to find external modules. Install it…

```console
```
npm install --save-dev rollup-plugin-node-resolve
```

Expand Down Expand Up @@ -137,7 +137,7 @@ Many developers use [Babel](https://babeljs.io/) in their projects in order to u

The easiest way to use both Babel and Rollup is with [rollup-plugin-babel](https://github.com/rollup/rollup-plugin-babel). First, install the plugin:

```console
```
npm i -D rollup-plugin-babel rollup-plugin-node-resolve
```

Expand Down Expand Up @@ -183,7 +183,7 @@ and the
[`env`](https://babeljs.io/docs/en/babel-preset-env)
preset:

```console
```
npm i -D @babel/core @babel/preset-env
```

Expand Down
2 changes: 1 addition & 1 deletion docs/999-big-list-of-options.md
Expand Up @@ -217,7 +217,7 @@ export default {
Namespaces are supported i.e. your name can contain dots. The resulting bundle will contain the setup necessary for the namespacing.

```
$ rollup -n "a.b.c"
rollup -n "a.b.c"
/* ->
this.a = this.a || {};
Expand Down

0 comments on commit 6e92e52

Please sign in to comment.