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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deal with permalink: false #9

Closed
bennypowers opened this issue Mar 2, 2021 · 4 comments
Closed

Deal with permalink: false #9

bennypowers opened this issue Mar 2, 2021 · 4 comments

Comments

@bennypowers
Copy link
Contributor

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch eleventy-plugin-add-web-component-definitions@2.0.1 for the project I'm working on because templates with permalink: false cause an error when running the package.

Here is the diff that solved my problem:

diff --git a/node_modules/eleventy-plugin-add-web-component-definitions/add-web-component-definitions.js b/node_modules/eleventy-plugin-add-web-component-definitions/add-web-component-definitions.js
index 2fbc2d6..da3ac31 100644
--- a/node_modules/eleventy-plugin-add-web-component-definitions/add-web-component-definitions.js
+++ b/node_modules/eleventy-plugin-add-web-component-definitions/add-web-component-definitions.js
@@ -16,6 +16,9 @@ const addChild = (body, child, position) => {
 }
 
 module.exports = function (options, content, outputPath) {
+  if (typeof outputPath !== 'string')
+    return content;
+    
   if (!!options.path && !!options.specifiers) {
     throw new Error('You may configure a path function or import specifiers, but not both')
   }

This issue body was partially generated by patch-package.

@jdvivar
Copy link
Owner

jdvivar commented Mar 3, 2021

What a great tool is patch-package! I didn't know it until now 馃榾
Fixing it 馃洜

@jdvivar
Copy link
Owner

jdvivar commented Mar 3, 2021

@bennypowers
What if your permalink actually doesn't end with html?

In the demo:

---
permalink: "whatever"
---
<custom-tag></custom-tag>

I also asked in 11ty/eleventy#653

@bennypowers
Copy link
Contributor Author

What a great tool is patch-package! I didn't know it until now 馃榾
Fixing it 馃洜

I know, right?

What if your permalink actually doesn't end with html?

I dunno, really, but maybe that's a separate issue?

@jdvivar jdvivar closed this as completed in 286ecef Mar 3, 2021
@jdvivar
Copy link
Owner

jdvivar commented Mar 3, 2021

I think I've found a good balance, tell me if it works well for you in your projects

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

No branches or pull requests

2 participants