Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for a valid blade extension when handling blade files #583

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jwpage
Copy link

@jwpage jwpage commented Sep 23, 2021

Blade files without valid exceptions in will cause an exception to be thrown during building. This is particularly noticeable with editor swap files (eg. vim has .foo.blade.php.swp) preventing the site from building. (Also reported in #274)

❯ ./vendor/bin/jigsaw build

Building local site
Building files from source...


In Factory.php line 291:

  Unrecognized extension in file: /Volumes/Code/home/jigsaw-test/source/foo.blade.bar.


build [--pretty PRETTY] [-c|--cache [CACHE]] [--] [<env>]

This PR makes BladeHandler::shouldHandle check that the file has a valid extra blade extension (as defined in extraBladeExtensions, or a standard blade.php extension. If not, it will be rendered by the default handler.

I'm not sure if this is the best approach, as it would silently let unlisted blade extensions pass through without the user being aware of it, but seems better than breaking the build entirely.

Would it possibly be better if we display a warning to the user notifying them of an invalid blade extension instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant