mirror of
https://github.com/django-components/django-components.git
synced 2025-09-02 20:27:20 +00:00
refactor: udpate formatting and wording for the "devguides" docs (#960)
This commit is contained in:
parent
fe128053c9
commit
de99abf6bf
2 changed files with 139 additions and 138 deletions
|
@ -57,7 +57,7 @@ associated with components, and how we render them.
|
|||
|
||||
3. Thirdly, we also want to add support for JS / CSS variables. That is, that a variable defined on the component would be somehow accessible from within the JS script / CSS style.
|
||||
|
||||
A simple approach to this would be to modify the inlined JS / CSS directly, and insert them for each component. But if you had extremely large JS / CSS, and e.g. only a single JS / CSS variable that you want to insert, it would be extremely wasteful to copy-paste the JS / CSS for each component instance.
|
||||
A simple approach to this would be to modify the inlined JS / CSS directly, and insert them for each component. But if you had extremely large JS / CSS, and e.g. only a single JS / CSS variable that you want to insert, it would be wasteful to create a copy of the JS / CSS scripts for each component instance.
|
||||
|
||||
So instead, a preferred approach here is to defined and insert the inlined JS / CSS only once, and have some kind of mechanism on how we make correct the JS / CSS variables available only to the correct components.
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
# Using `slot` and `block` tags
|
||||
|
||||
1. First let's clarify how `include` and `extends` tags work inside components.
|
||||
So when component template includes `include` or `extends` tags, it's as if the "included"
|
||||
|
||||
When component template includes `include` or `extends` tags, it's as if the "included"
|
||||
template was inlined. So if the "included" template contains `slot` tags, then the component
|
||||
uses those slots.
|
||||
|
||||
So if you have a template `abc.html`:
|
||||
If you have a template `abc.html`:
|
||||
```django
|
||||
<div>
|
||||
hello
|
||||
|
@ -46,7 +47,7 @@
|
|||
|
||||
2. Slot and block
|
||||
|
||||
So if you have a template `abc.html` like so:
|
||||
If you have a template `abc.html` like so:
|
||||
|
||||
```django
|
||||
<div>
|
||||
|
@ -105,7 +106,7 @@
|
|||
<div>hello 1 XYZ</div>
|
||||
```
|
||||
|
||||
3. You CAN override the `block` tags of `abc.html` if my component template
|
||||
3. You CAN override the `block` tags of `abc.html` if the component template
|
||||
uses `extends`. In that case, just as you would expect, the `block inner` inside
|
||||
`abc.html` will render `OVERRIDEN`:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue