Skip to main content

bud.define

bud.define replaces variables in your application code and html templates at compile time.

Usage

Call bud.define and pass your definitions.

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>

Caveats

This replacement is static and happens at build time. It is not the same as a runtime variable.

Doing things like attempting to reassign its value in your application code will not work.