MJMLify is a simple project built using Node.js that converts MJML files to HTML and supports multi-language translation. It utilizes the "mjml" dependency to handle MJML to HTML conversion.
The project has the following folder structure:
- src
- mjml // Contains MJML files
- lang // Contains translation files in JSON format for different languages
- html // Contains the output HTML translations
- helpers // Contains utility functions for generating HTML, deleting translations, and listing supported languages
In the project directory, you can run the following scripts:
npm run convert <file_name> <language_code>
This script converts a single MJML file to HTML for a specific language.
- <file_name>: The name of the MJML file to convert (without the extension)
- <language_code>: The language code (e.g., 'yor' for Yoruba, 'en' for English, 'fr' for French)
npm run convert_all <language_code>
This script converts all MJML files to HTML for a specific language.
- <language_code>: The language code (e.g., 'yor' for Yoruba, 'en' for English, 'fr' for French)
npm run delete_all <language_code>
This script deletes all translations (HTML files) for a specific language.
- <language_code>: The language code (e.g., 'yor' for Yoruba, 'en' for English, 'fr' for French)
npm run ls_lang
This script lists all supported languages.
To get started with the MJMLify project, follow these steps:
- Clone the repository:
git clone https://github.com/your-username/mjmlify.git
- Install dependencies:
npm install
- Place your MJML files in the
src/mjml
folder. - Create translation JSON files in the
src/lang
folder for each supported language. - Run the desired scripts to convert, delete, or list translations.
Feel free to customize the project structure and add more features as per your requirements.
The project supports the following languages:
- Yoruba (yor)
- English (en)
- French (fr)
Please refer to the language codes mentioned above when using the conversion and deletion scripts.