Skip to main content

bud.setPath

You can use bud.setPath to set a bud.path handle. This documentation probably makes more sense if you've read the bud.path documentation.

Defining new handles

There are only two real rules for defining custom path handles:

  • A path handle must be unique
  • A path handle must be a string which begins with a @

To make a reference to the ./src/scripts/components directory we could write:

bud.setPath('@components', '@src/scripts/components')

In the future we can utilize that reference:

bud.path('@components') // => './src/scripts/components'

Overriding existing handles

We can redefine the path to source assets like so:

bud.setPath('@src', 'sources')

Lastly, we can define multiple paths (built-in or custom) in a single call by using an object:

bud.setPath({
'@src': 'sources',
'@components': '@src/scripts/components',
})

Note that if we were to change @src again that @components path would still reference the old value. This is something to be aware of.