Skip to content

Commit

Permalink
Create block: Add support for static assets
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Jan 7, 2021
1 parent 457b02e commit 3c50043
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions packages/create-block/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,39 @@ Since version `0.19.0` it is possible to use external templates hosted on npm. T

### Template Configuration

It is mandatory to provide the main file for the package that returns a configuration object. It must containing at least `templatesPath` field with the path pointing to the location where template files live (nested folders are also supported).
It is mandatory to provide the main file (`index.js` by default) for the package that returns a configuration object. It must contain at least the `templatesPath` field.

#### `templatesPath`

A mandatory field with the path pointing to the location where template files live (nested folders are also supported). All files without the `.mustache` extension will be ignored.

_Example:_

```js
const { join } = require( 'path' );

module.exports = {
templatesPath: __dirname,
templatesPath: join( __dirname, 'templates' ),
};
```

It is also possible to override the default template configuration using the `defaultValues` field.
#### `assetsPath`

This setting is useful when your template scaffolds a block that uses static assets like images or fonts, which should not be processed. It provides the path pointing to the location where assets are located.

_Example:_

```js
const { join } = require( 'path' );

module.exports = {
assetsPath: join( __dirname, 'assets' ),
};
```

#### `defaultValues`

It is possible to override the default template configuration using the `defaultValues` field.

_Example:_

Expand Down

0 comments on commit 3c50043

Please sign in to comment.