Conversation
tsx/README.md
Outdated
| } | ||
| ``` | ||
|
|
||
| This 11ty template gets `name` and `content` from the passed-in `data` object. If the `content` string comes from an untrusted source, you might want to "purify" it (to prevent XSS.) |
There was a problem hiding this comment.
Why does "purification" and preventing XSS need to be mentioned here? It isn't unique to this template language right?
There was a problem hiding this comment.
I'm fine with removing it. If I don't hear back, I'll do the removal.
|
|
||
| ## How it works | ||
|
|
||
| Eleventy template files ending in `.11ty.tsx` will be processed by this plugin, by means of the [`tsx` project](https://tsx.is). `tsx` turns the template into JSX nodes using the [`esbuild`](https://esbuild.github.io) package. |
There was a problem hiding this comment.
Why do they have to end in .11ty.tsx? Seems like an odd constraint...
There was a problem hiding this comment.
The .11ty part is required by 11ty. The .tsx is connected to tsconfig.json and the compiler. While it might be possible to configure the toolchain to accept another file extension, it would be very atypical.
Either way, it's the choice made by this plugin. Kind of matches other template language plugins, which provide default mappings.
There was a problem hiding this comment.
Why is it required? I've never used anything but plain .tsx extensions before, so it seems like Eleventy is the only blocker here?
There was a problem hiding this comment.
Right. Look in the "File Extension" column in the current docs. This is related to their derivation from JavaScript Templates.
11ty thinks these JSX/TSX templates are actually just JavaScript Templates with a different compile property.
There was a problem hiding this comment.
Ahh gotcha. And there isn't a way to get Eleventy to think like that and remove the 11ty. part?
There was a problem hiding this comment.
It's a derivation of JavaScript Templates and it follows what Zach has for existing JSX/TSX documentation.
If you'd like, I could tinker with changing the line key: "11ty.js" in tsxConfig.js. Perhaps it isn't important for people to think of these as JavaScript Template types.
Fix to my mistaken links to 11ty official repo. Co-authored-by: uncenter <[email protected]>
|
Just checking back on this. I believe the only major open question is: would you like these two languages (TSX, JSX) merged into one PR? |
No description provided.