Skip to content

useLayouts option for Custom template syntax allows opt-out of Eleventy Layouts for a template type #2830

@rustycoat

Description

@rustycoat

Operating system

Debian Testing

Eleventy

2.0.0

Describe the bug

Per instructions on the website and in various github issues, default layouts can be provided at the directory level (including the root via various methods). Unfortunately, these layouts are not specified to relevant file types and will wrap ALL 'templates' with the layout template, including assets that intend to generate css or javascript (or other new applications, like processing images).

Reproduction steps

  1. Set dir.input to 'src', create 'src' directory and add two files: 'layout.njk' and 'asset.scss'. Make sure layout.njk outputs {{ content | safe }}.
  2. Set the global layout either via src/src.json or via config object to 'layout.njk'.
  3. Use addTemplateFormats and addExtension to implement sass preprocessing as shown on the website.
  4. Run eleventy build and view the contents of asset.scss to see that the contents of layout.njk have been wrapped around it, with asset.scss taking the place of {{ content | safe }}.

Expected behavior

Expect that SCSS files will not be treated as an object with a 'layout'.

Reproduction URL

No response

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions