Skip to content

"Inline" includes #36

@HoldYourWaffle

Description

@HoldYourWaffle

I'd love to see a way to define inline includes: reusable blocks of HTML that can be inserted at will without the need for a separate file.

It's perhaps best explained with an example (I used var as "declaration" tag for now, block is already used by reshape/layouts and I just couldn't think of anything better):

<var name="foo">
    <span style="red">Something</span>
    <span style="blue">interesting</span>
</var>


<h1>
    <include src="foo"></include>
</h1>

<p>
    Hello there!
</p>

<p>
    <include src="foo"></include>
</p>

<p>
    Isn't that fascinating?
</p>

Would result in:

<h1>
    <span style="red">Something</span>
    <span style="blue">interesting</span>
</h1>

<p>
    Hello there!
</p>

<p>
    <span style="red">Something</span>
    <span style="blue">interesting</span>
</p>

<p>
    Isn't that fascinating?
</p>

Advantages

  • This allows you to put related things together (in the same file), making it easier to find referenced code
  • No need for unnecessary (and cluttering) files

Disadvantages

  • Templates can become more cluttered/complex (although that's at the designers own discretion)
  • Maintenance I guess?

Things I haven't fully thought out yet

  • How would this work with nested includes?
  • Syntax, both for declaring and referencing

I'd be willing to take a shot at this myself but I haven't done any plugin development yet so I might need some pointers on what I should do and where I should look for information on how to do that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions