Skip to main content

bud.define

Replace variables in your application code and templates at compile time.

Usage

Call bud.define and pass your definitions.

bud.config.js
bud.define({
APP_NAME: 'My Application',
})

Any instances of APP_NAME in your application code will be replaced with My Application.

src/app.js
console.log(APP_NAME)

Replacements will also be made when compiling html templates.

public/index.html
<html>
<title>%APP_NAME%</title>
<!-- ... -->
</html>

Signature

@roots/bud-api/types/repository/index.d.ts
interface Define {
(this: Bud, values: Webpack.DefinePlugin['definitions']): Bud
}