Skip to content
This repository was archived by the owner on Aug 15, 2026. It is now read-only.

Commit 0912a4a

Browse files
committed
docs: add info
1 parent 338d746 commit 0912a4a

3 files changed

Lines changed: 33 additions & 2 deletions

File tree

docs/blog/2026-03-20-textwire-v4.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,20 @@ This separation makes the code more readable and the relationship between compon
229229

230230
When you see `@pass`, you know content is being sent. When you see `@slot`, you know it's a placeholder waiting to receive content.
231231

232+
### 6.3 Closing Component is Required
233+
234+
In Textwire v4, you should always close your components even if they don't have any content. This is to avoid confusion and make the syntax more consistent. In previous versions, you could write:
235+
236+
```textwire
237+
@component('components/icons/book')
238+
```
239+
240+
Starting from version 4, you need to write this instead:
241+
242+
```textwire
243+
@component('components/icons/book')@end
244+
```
245+
232246
## 7. Cleaner Output with Block Trimming
233247

234248
All block directives in v4 now automatically trim surrounding whitespace. This affects:

docs/versions/v4/language-elements/directives.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ The second optional argument is an [object](/v4/language-elements/literals#objec
243243
- **Name is a constant.** The first argument (name) is the constant, it cannot be dynamic, only literal strings are allowed.
244244
- **Argument must be an object literal.** Second argument for components must be an object literal. If you provide a non-object literal, it will result in an error.
245245
- **Layout for components.** You can include layout file into components using [`@use`](/v4/language-elements/directives#use) directive, but it can make your templates more complex and harder to maintain. We recommend to avoid using layouts in components and keep them simple.
246-
- **Use slots to pass data.** You can use [slot](/v4/language-elements/directives#slot) and [slotif](/v4/language-elements/directives#slotif) in components to pass content to the component file.
246+
- **Use passes to pass data.** You can use [@pass](/v4/language-elements/directives#pass) and [@passif](/v4/language-elements/directives#passif) in components to pass content to the component file.
247247
- **Use path alias.** If your components are located in the `components` directory, you can use the `~` alias to reference them. Read about [Path Aliases](/v4/faq#what-are-the-path-aliases).
248248

249249
## @slot

docs/versions/v4/upgrade.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,22 @@ grep -r '@slot(' templates/
244244

245245
Don't rename slots that are placeholders in your component files, they should keep being `@slot('name')`.
246246

247+
### 3. Closing Component is Required
248+
249+
In Textwire v4, you should always close your components even if they don't have any content. This is to avoid confusion and make the syntax more consistent. In previous versions, you could write:
250+
251+
```textwire
252+
@component('components/icons/book')
253+
```
254+
255+
Starting from version 4, you need to write this instead:
256+
257+
```textwire
258+
@component('components/icons/book')@end
259+
```
260+
261+
Just search for `@component(` and make sure all of your components are closed.
262+
247263
## 8. Blocks are Trimmed by Default
248264

249265
All blocks in Textwire are now left and right trimmed, it should not effect your HTML because HTML ignores whitespace, but it can effect your string outputs. If you have something like this:
@@ -270,7 +286,8 @@ After completing the migration:
270286
8. <input type="checkbox"> Project prints proper strings with `{{ }}` braces
271287
9. <input type="checkbox"> For passing default slots, we don't use `@slot` directive, we just passing them inside of a component's block (body)
272288
10. <input type="checkbox"> All `@slot('name')<some content>@end` directives inside of a component block (body) are renamed to `@pass('name')<some content>@end`
273-
11. <input type="checkbox"> Project compiles successfully
289+
11. <input type="checkbox"> All components have a closing directive, even with empty body
290+
12. <input type="checkbox"> Project compiles successfully
274291

275292
## Need Help?
276293

0 commit comments

Comments
 (0)