-
-
Notifications
You must be signed in to change notification settings - Fork 493
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
outputPath.endsWith check fails with permalink: false #653
Comments
Hmmmmmmmmmmmmmmmmmm… Should we solve this in the library? Transforms should run on |
How about |
Hmm, this makes me a little uncomfortable because it’s a little bit of magic? Right now Not saying no, just want to think it out all the way. One other question that comes to mind: if you set |
You could require |
I just came across this - added the html minification example to my Two things caused this:
I'm not sure the transform necessarily needs to so something differently, but I think the example code for minification should handle this case. Something as simple as testing for a string / url and then proceeding. It using |
For anyone coming across this by using the html-minifier example in the docs and a link to an outside url using
|
* outputPath is not guaranteed to be a string when permalink is set to false. See: 11ty/eleventy#653 * Favour optional chaining Co-authored-by: Mark van Seventer <mark@vseventer.com> Co-authored-by: Peter <peterc@optum.com> Co-authored-by: Mark van Seventer <mark@vseventer.com>
What if the outputPath has no html file extension? As in:
How would a transform plugin for HTML would know the file to transform is HTML prior to the transformation itself? |
I think I found a good balance in my plugin to deal with both undefined file extensions and permalink false: |
I also came across this issue by following the html-minifier transform example in the docs. I fixed it by changing the code as @davidysoards suggested (thanks!). It seems to me that the most immediate problem is not necessarily that there's anything unintuitive about the API, but that the docs contain a code example that breaks fairly easily (i.e. whenever any template has |
@igelstorm you're welcome! glad it helped someone. |
I think the docs page is at https://github.com/11ty/11ty-website/blob/master/docs/config.md, if somebody want to create a Pull request for this. |
I have opened a PR to fix the minification example and clarify this behaviour in a few other places in the docs: 11ty/11ty-website#991 Comments welcome from anyone who encountered this issue about whether these changes would've been enough to help them at the time! |
My temporary and not smart solution for such case with AMP-plugin is to not use false value for permalink and generate empty page with no collision for plugin
|
Describe the bug
When you have files with
permalink: false
thenoutputPath.endsWith
check fails.To Reproduce
permalink: false
that resolves into*.html
Expected behavior
Successful build.
Environment:
Additional context
It could be fixed by checking if
outputPath
is available:…or by changing the
outputPath
behavior, which is preferable :)The text was updated successfully, but these errors were encountered: