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

Update bundle.md #697

Merged
merged 1 commit into from
May 4, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions doc/bundle.md
Original file line number Diff line number Diff line change
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