fresh icon indicating copy to clipboard operation
fresh copied to clipboard

docs: create docs for _app.tsx

Open harrel56 opened this issue 2 years ago • 4 comments

I've decided to write some docs on my own (regarding issue #491) . Keep in mind that I have no technical writing experience and treat it more like a sketch. All suggestions are welcome - most importantly, check if everything I wrote is true.

Additionally, I slipped in 1 typo fix

harrel56 avatar Jul 10 '22 11:07 harrel56

You might want the app-wrapper.md file to focus on layout (and maybe renamed to layout.md) and have _app.tsx as one option. Another option would be to use a Layout component to wrap the app. Both of them could use the Head component to add an html head element with its child elements to the app.

cdoremus avatar Jul 12 '22 21:07 cdoremus

You might want the app-wrapper.md file to focus on layout (and maybe renamed to layout.md) and have _app.tsx as one option. Another option would be to use a Layout component to wrap the app. Both of them could use the Head component to add an html head element with its child elements to the app.

I'm not sure if splitting this feature into 2 pages is such a good idea. If it's possible, please propose your changes by code suggestions. But all of this doesn't really matter, because it seems this PR is not getting merged. I hope the replacement for _app.tsx will get implemented soon, as this feature seems to really needed by users.

harrel56 avatar Jul 13 '22 20:07 harrel56

Thank you I almost given up

ahmtcn123 avatar Aug 01 '22 14:08 ahmtcn123

Any update on this getting merged? I think it's pretty clear.

lino-levan avatar Aug 28 '22 22:08 lino-levan

Not sure if this makes sense to merge given that _app.tsx will be removed in favor of layouts (at some distant point in the future). I'd still support it being merged since this is kind of the only way to do it at the moment.

lino-levan avatar Mar 02 '23 21:03 lino-levan

@lino-levan I think it would be good to add this until the layout feature comes along. I guess the layout feature is still a ways off.

hashrock avatar Mar 02 '23 21:03 hashrock

Agreed.

lino-levan avatar Mar 02 '23 21:03 lino-levan

@lambtron Code example updated to the latest. I have also verified that the description is correct, could you double check?

The following are memo during confirming what has been written:

There is also a possibility to modify the document template by using special tags html, Head or body. This can be done in any other Preact component

I tried this. Indeed, I was able to do this from components as written.

Currently, there is no way of overriding default tags/attributes from provided template.

This is also true. For example, setting <body class="foo"> in _app.tsx and <body class="bar" data-baz="1"> in index.tsx will render <body class="foo" data-baz="1">. You can add attribute but not overwrite.

(There is a <html lang="en"> set before _app.tsx', so _app.tsx also cannot override by lang="ja")

hashrock avatar Mar 06 '23 19:03 hashrock

LGTM!

lambtron avatar Mar 07 '23 17:03 lambtron