📅  最后修改于: 2023-12-03 14:44:19.241000             🧑  作者: Mango
The mjml watch
command is a useful feature provided by MJML that automatically compiles your MJML files into responsive HTML whenever you make changes to the files. This is extremely useful for developers as it eliminates the need to manually compile MJML files every time you make a modification.
Before using the mjml watch
command, you need to have MJML installed on your system. You can install MJML globally using npm with the following command:
npm install -g mjml
To use mjml watch
, navigate to the directory that contains your MJML files and run the following command:
mjml watch
MJML will monitor the directory for any changes to the MJML files and automatically compile them into HTML. The generated HTML files will have the same name as the corresponding MJML files, but with the .html
extension.
Below is an example of how to use the mjml watch
command in a sample script:
#!/bin/bash
# Compiles MJML files into HTML whenever changes are made
mjml watch
Make sure to save the script with a .sh
extension and execute it using a shell or bash.
The output generated by the mjml watch
command will be in Markdown format. You can easily include the output in your Markdown files by using the proper Markdown syntax. Here's an example:
The MJML watch command is a convenient feature that automatically compiles MJML files into HTML whenever changes are made. To use it, simply navigate to the directory containing your MJML files and run the following command:
```bash
mjml watch
This will start monitoring the directory for changes and compile the MJML files into HTML automatically. The generated HTML files will have the same names as the corresponding MJML files, but with the .html
extension.
By including the above Markdown snippet in your documentation or README files, you can provide clear instructions to other developers on how to use the `mjml watch` command.
Remember to adjust the styling and formatting of the Markdown output according to your needs.