Skip to content

Add addTransform option to filter by outputPath file extension (better handle outputPath.endsWith check fails with permalink: false) #653

Description

@pepelsbey

Describe the bug

When you have files with permalink: false then outputPath.endsWith check fails.

if(outputPath.endsWith('.html')) {  }
> Having trouble writing template: false (TemplateWriterWriteError)
> outputPath.endsWith is not a function (TypeError):

To Reproduce

  1. Create a file with permalink: false that resolves into *.html
  2. Add a transform, just like in this example.
  3. Build

Expected behavior

Successful build.

Environment:

  • OS and Version: macOS 10.14.6
  • Eleventy Version: 0.8.3

Additional context

It could be fixed by checking if outputPath is available:

if(outputPath && outputPath.endsWith('.html')) {  }

…or by changing the outputPath behavior, which is preferable :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions