Skip to content

Commit

Permalink
Merge pull request #697 from stealjs/pYr0x-patch-1
Browse files Browse the repository at this point in the history
Update bundle.md
  • Loading branch information
matthewp committed May 4, 2017
2 parents 3eb9d6c + 884ae57 commit 060d751
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions doc/bundle.md
Expand Up @@ -21,7 +21,7 @@ Specifies the behavior of the build.
The following uses steal-tools `bundle` method to programatically build out the "my-app"
dependencies in the `node_modules` folder.

```

var path = require("path");
var stealTools = require("steal-tools");

Expand All @@ -30,7 +30,7 @@ dependencies in the `node_modules` folder.
}, {
filter: "node_modules/**/*"
});
```


This will build bundles at the root of your project like:

Expand All @@ -51,7 +51,7 @@ The `filter` option specifies a glob pattern what modules are included in the bu

It can be a string with a single pattern or an array if multiple patterns are needed; the [multimatch](https://github.com/sindresorhus/multimatch) library is used to support multiple patterns, check its docs to see how the matching works.

```

var path = require("path");
var stealTools = require("steal-tools");

Expand All @@ -60,22 +60,22 @@ It can be a string with a single pattern or an array if multiple patterns are ne
}, {
filter: "node_modules/**/*"
});
```


The `filter` value used in the example above will create a bundle of the modules loaded by the application which are located in the `node_modules` folder.

## dest

The `dest` option specifies **a folder** where the bundles are written out.

```

var promise = stealTools.bundle({
config: path.join(__dirname, "package.json!npm")
}, {
dest: path.join(__dirname, "my-bundle"),
filter: "node_modules/**/*"
});
```


This will build bundles like:

Expand All @@ -95,13 +95,13 @@ The main use case for custom bundles is to speed up the loading time of your app

We call a **dependencies bundle** a bundle that only includes the application dependencies (all the modules in the `node_modules` folder if you are using `npm`), to generate it you would do something like:

```

var promise = stealTools.bundle({
config: path.join(__dirname, "package.json!npm")
}, {
filter: "node_modules/**/*"
});
```


In order to load a **dependencies bundle** you would need to add the `deps-bundle` attribute to the StealJS script tag, like this:

Expand All @@ -111,14 +111,14 @@ In order to load a **dependencies bundle** you would need to add the `deps-bundl

We call a **development bundle** a **dependencies bundle** that also includes the [StealJS configMain](StealJS.config.configMain) module; in order to generate it you'd do something like:

```

var promise = stealTools.bundle({
config: path.join(__dirname, "package.json!npm")
}, {
dest: path.join(__dirname, "my-dev-bundle"),
filter: [ "node_modules/**/*", "package.json" ]
});
```


Unlike a **dependencies bundle**, a **development bundle** has to be loaded before [StealJS configMain](StealJS.config.configMain) is loaded. In order to do that, StealJS provides a `dev-bundle` propert that you can set to the script tag so it loads the bundle correctly, like this:

Expand Down

0 comments on commit 060d751

Please sign in to comment.