Download the PHP package capsulescodes/inertia-mailable without Composer
On this page you can find all versions of the php package capsulescodes/inertia-mailable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download capsulescodes/inertia-mailable
More information about capsulescodes/inertia-mailable
Files in capsulescodes/inertia-mailable
Package inertia-mailable
Short Description Seamlessly craft dynamic and reusable email templates using Inertia
License MIT
Informations about the package inertia-mailable
Seamlessly craft dynamic and reusable email templates using Inertia.
Inertia Mailable empowers you to build beautiful, component-driven emails in Laravel, utilizing the power of InertiaJS. Create interactive and responsive email designs effortlessly by composing components and embedding them into your mailables.
For React users, this article provides an in-depth exploration of the package. For Vue users, this article provides an in-depth exploration of the package.
Installation
1. Install package and publish expected inertia mailable file
It publishes three files :
resources/css/mail.css
: base Tailwind CSS fileresources/{js,ts}/mail.{js,ts,jsx,tsx}
: base Inertia fileresources/{js,ts}/mails/Welcome.{jsx,tsx,vue}
: example Components
2. Add Inertia file and CSS file in Laravel vite config ssr array
vite.config.js
3. Add SSR to build
script and build files
package.json
Usage
App\Mails\InertiaMailableInstalled.php
routes/web.php
> http://127.0.0.1:8000/render
You are now ready to send.
routes/web.php
- replace '[email protected]' with the desired email address in
routes/web.php
andApp\Mail\InertiaMailableInstalled.php
.
Supported Frameworks
- [x] Inertia mailable supports Laravel.
- [x] Inertia Mailable supports Vue.
- [x] Inertia Mailable supports Vue with Typescript.
- [x] Inertia Mailable supports Vue with Tailwind CSS.
- [x] Inertia Mailable supports React.
- [x] Inertia Mailable supports React with Typescript.
- [x] Inertia Mailable supports React with Tailwind CSS.
Options
- Build your email with Watch mode
You can dynamically build your component while working on it by enabling the --watch
option in your package.json
script. This ensures your components are rebuilt automatically when changes are detected.
- Add a custom root blade view
If you want to modify the current blade file, publish the template and modify the path in the inertia-mailable
config file.
App\Mails\InertiaMailableInstalled.php
- Specify the actual path to node
If you encounter the following error : sh: line 0: exec: node: not found
, add node binary's absolute path in the inertia-mailable
config file or add NODE_PATH
in your .env
file.
config/inertia-mailable.php
- Emit CSS file in SSR directory
Since Vite, by default, does not emit assets outside the public
directory, Inertia Mailable follows the same approach. However, if you want to build all related files into the ssr
directory, indicate it in the Vite config file and change the Inertia mailable config file.
vite.config.js
config/inertia-mailable.php
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.