-
Notifications
You must be signed in to change notification settings - Fork 694
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
feat (packages): VS Code extension for previewing emails just like markdown #996
feat (packages): VS Code extension for previewing emails just like markdown #996
Conversation
also changed the preview directory to not conflict with my other PR
…fined, show the message this is because the message doesnt really have the full contents of the error, while the stack does
… htmls more stabilized
…are done, even without saving
this is to avoid too many temp files being created
this is because it just became to coomplicated when trying to update on text change but there are still a few commits before this that are trying to make this work, couldn't make it work well though
this is to avoid too large of a extension to publish
I tested it by installing the .vsix package from vs code itself
…re release version
…at are not email templates
0426d02
to
868acde
Compare
74d49e5
to
6facd7c
Compare
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Also adds npm as official packageManager there as npm
…ing .vscpreview folder
8ece1ee
to
60663b3
Compare
|
Closing in favor of #1835 |
VS Code extension for previewing emails
Here is a GIF of how the usage of the VS Code extension feels and looks like
Had to keep the GIF low quality and with a low framerate to not get to the 10MB limit for gh.
What does this PR change?
This PR should add a new package that comprises the basis of a new VS Code extension
for previewing the current focused email made with react-email.
This is the implementation of the idea coming from the discussion #574.
What is the extension's details?
It's an extension that has just one command, that can be called with a keybinding (currently CTRL+SHIFT+E or CMD+SHIFT+E for mac)
that opens a split panel beside the current file focused. Once you focus a file that has a email on it, it automatically
generates the preview and renders it there. Currently it only updates once you saved the email, but I think after
some work it can be done to update as the user changes the email component.
Some of the features included in this are:
react-email dev
prewview clientWhat are some technical aspects of the extension?
I think a good way to describe the technical aspects of this is to describe the workflows the extension
goes through when trying to render a focused email.
So, the steps taken for the rendering of the email are, once a save or a focus of file change occurs:
emails
folder is, where the email is and then bundle the email using esbuild into a temporary.vscpreview
folderimport
doesn't cache the module of the email and that it is hopefully unique each render@react-email/render
to render the email into HTML (and plain text for the possible future)/assets
will be rendered in the panel instead, with the error message printed on itsrc="/static/..."
and makes sure that these URIs are compliant with how VS Code expects them to be so the static files are rendered properlyOk, sounds great, how can I run and check it out?
Here is a step-by-step to run it using VS Code and see how everything feels with the current changes:
gh pr checkout 996
which will automatically checkout into the PR./packages/vs-code-extension
folder relative to the root of the repositorypnpm install
and then runnpm run compile
somewhere so that the typescript files are compiled to be ranF5
to run the extension in debug modeCTRL + SHIFT + E
(orCMD + SHIFT + E
for Mac) or going into the command pallete and searching for "Start live preview of email open"./demo
directory relative to the root of the repo)What are the next steps after merging?
After merging we will need to publish the extension into VS Code but I think most of the work is done, we can also work together
to publish this if any problems occur and need fixing.
Thanks for reading, thinking about the PR and for the awesome project!