logo dile-components dile CLI

Configuration

The CLI searches for configuration using cosmiconfig in the current directory (process.cwd()), in this order:

Command to generate configuration file

Dile CLI provides a command to generate the configuration file: dile congig-init. You will find more information in the config-init command documentation page.

Module format for dile.config.js

The module format expected for dile.config.js depends on your package.json configuration:

For explicit control, you can also use dile.config.cjs (CommonJS) or dile.config.mjs (ES modules) to bypass the package.json type detection.

Tip: Use debug mode if you're not getting the expected configuration from your config file. This will help you identify which configuration file is being loaded and what values are being resolved.

Base paths

You can configure the base output paths in two ways:

1) Recommended (object with basePath)

// dile.config.js
export default {
  components: { basePath: 'src/components' },
  resources: { basePath: 'src/resources' },
};

2) Short form (string)

// dile.config.js
export default {
  components: 'src/components',
  resources: 'src/resources',
};

In package.json

{
  "dile": {
    "components": { "basePath": "src/components" },
    "resources": { "basePath": "src/resources" }
  }
}

Component Prefix

You can configure a prefix for component names:

// dile.config.js
export default {
  components: { basePath: 'src/components' },
  resources: { basePath: 'src/resources' },
  componentPrefix: 'my',
};

When a prefix is set, generated components will use it in their tag names. For example, a button component would be named my-app-button instead of button.

You can also set this during configuration initialization:

dile config-init --prefix my-app

If there is no configuration, the default values are:

Conventions and validations