2021-10-17 18:26:00 +02:00
|
|
|
---
|
|
|
|
title: inject
|
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-02-05 17:44:23 +01:00
|
|
|
The `inject` key in the pattern configuration file allow you to configure
|
|
|
|
the rules for injecting one part into another.
|
2022-02-20 14:35:50 +01:00
|
|
|
By _injecting_ we mean that rather than starting out with a fresh part,
|
2022-02-05 17:44:23 +01:00
|
|
|
you'll get a part that has the points, paths, and snippets of the injected part.
|
|
|
|
|
|
|
|
## Structure
|
|
|
|
|
2022-02-19 08:04:25 +01:00
|
|
|
A plain object of key/value pairs of parts.
|
2022-02-05 17:44:23 +01:00
|
|
|
The `value` part will be injected in the `key` part.
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
2021-08-25 16:09:31 +02:00
|
|
|
```js
|
|
|
|
inject: {
|
|
|
|
front: "back"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2022-02-05 17:44:23 +01:00
|
|
|
In this example, the `back` part will be injected in the `front` part.
|
|
|
|
In doing so, the `front` part will start out as a copy of the `back` part.
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
<Tip>
|
|
|
|
|
2022-02-05 17:44:23 +01:00
|
|
|
See [the Howto on Part inheritance](/howtos/code/inject) for a hands-on example.
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
</Tip>
|