Skip to content

Should TemplateIterator return only template files #28282

@dtrputec

Description

@dtrputec

Description
Currently TemplateIterator::findTemplatesInDirectory($dir, $namespace = null) is returning everything from directory because of this line foreach (Finder::create()->files()->followLinks()->in($dir) as $file)

Example
Since this is a template iterator, does it makes sense to filter only template files from directory?Something like this foreach (Finder::create()->name('*.twig')->files()->followLinks()->in($dir) as $file)

This is useful when you want to have in your template directory related assets like *.js or *.css or event whole node_modules directory.

I can provide a PR with unit tests if you want.

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