npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mjml-project

v1.1.1

Published

Bootstrap and develop your email project using MJML

Downloads

12

Readme

mjml-project

This package helps you develop MJML projects:

  • Create a basic MJML project structure to bootstrap your email development
  • Process your MJML files along with additional data interpolation using Twig.js
  • Locally serve your processed MJML files with "hot reloading" while you develop

Installation

npm install --save-dev mjml-project
yarn add --dev mjml-project

Usage

Create a new project

This command will bootstrap your project within a folder called my-project:

npx create-mjml-project my-project

This command will bootstrap your project in the current directory with the name my-project:

npx create-mjml-project my-project .

NOTE: if using the . file path option, the contents of the current folder must be empty. An error will prevent you overwriting existing folder contents.

The folders it will create are:

# Contains source code for custom MJML components
/src
  /components
    HelloWorld.js

# Contains transpiled code for custom MJML components
/components
  HelloWorld.js

# Contains re-usable MJML partial templates
/partials

# Contains all your MJML layouts representing your email designs
/layouts
  # Nested folders can help organise your files
  /example
    hello-world.mjml

# Any data you wish to inject into templates
/data
  # You can have shared data files which the data
  # will be included in all the processed templates
  shared.json

  # If using data interpolation within your templates,
  # you will need to match the `/templates` folder structure
  /example
    # You can also have shared data per nested folder.
    # All templates within `/templates/example` will use
    # this shared data file along with `/data/shared.json`
    # and any other data file which has the same name.
    shared.json

    # This is a template specific data file which it will
    # only be included when processing the file
    # `/templates/example/hello-world.mjml`
    hello-world.json

# Any files that won't be processed can go here
/public
  /fonts
  /images
  /styles

# The folder that will contain your processed HTML files
/build

Process your MJML project into email-ready HTML

npx mjml-project process

This will take the contents of /templates and /data and process the files into email appropriate HTML to the /build folder.

Serve files locally while developing your MJML project

npx mjml-project process --watch

Files are also served using browser-sync. Any changes you make to files in the /templates and /data folder will trigger those files to be updated in the browser, so you can see the fruits of your labour in real-time.

Contribute

Have suggestions, questions or feedback? Found a bug? Post an issue

Added a feature? Fixed a bug? Post a PR

License

Apache 2.0