> For the complete documentation index, see [llms.txt](https://coldbox-elixir.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://coldbox-elixir.ortusbooks.com/v3/working_with_scripts.md).

# Working With Scripts

You can compile scripts using the `mix.js` method. It accepts either a single file or an array of files to combine. Each file will be crawled for dependencies by Webpack.

```javascript
const elixir = require("coldbox-elixir");

module.exports = elixir(mix => {
    mix.js("app.js");
    mix.js([
        "node_modules/jquery/dist/jquery.min.js",
        "node_modules/bootstrap-sass/assets/javascripts/bootstrap.min.js"
    ], {
        name: "bootstrap",
        entryDirectory: ""
    });
});
```

The second argument to `mix.js` is a configuration object.

```javascript
{
    name: this.withoutExtension(filename),
    outputDirectory: "includes/js/",
    entryDirectory: "resources/assets/js/"
}
```

## `runtime.js` and `vendor.js`

Using `mix.js` or any methods that depend on it create up to two additional files that you should be aware of: `runtime.js` and `vendor.js`. `runtime.js` is the Webpack runtime and should be included as the first script on your page. Without this script, your other files will fail silently. The `vendor.js` is comprised of any dependencies pulled from `node_modules`. This allows your users to keep using the cached `vendor.js` file even when you change your application code. This file should be included after `runtime.js` and before any of your application code.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://coldbox-elixir.ortusbooks.com/v3/working_with_scripts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
