# Running Elixir

Elixir is built on top of Webpack, so to run your Elixir tasks you only need to run the `webpack` command in your terminal. Before running Webpack, you will need a `webpack.config.js` file in the root of your project. Below is a simple example:

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

module.exports = elixir(mix => {
    mix.js("app.js");
});
```

Please note that by adding the `-p` flag to the command will turn on Webpack's production mode. This will minify your CSS and JavaScript files as well as add long-term caching hashes to your compiled files.

## Watching Assets For Changes

For performance and convienence, you can run Webpack in watch mode by passing the `-w` or `--watch` flag. Any changes to your source files will automatically re-run your build. Note that your build will be significantly faster on subsequent changes than when running Webpack from scratch.

## NPM Scripts

The easiest way to run Webpack is to set up some NPM scripts. Here are the following we recommend:

```javascript
"scripts": {
    "dev": "webpack --hide-modules",
    "watch": "npm run dev -- --watch",
    "prod": "npm run dev -- -p"
}
```

Then from the terminal you can run `npm run [scriptName for this example either dev, watch or prod]` to run the associated script.


---

# Agent Instructions: 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:

```
GET https://coldbox-elixir.ortusbooks.com/running_elixir.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
