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

ejs-serve

v1.2.33

Published

Build, watch and serve your EJS templates in your browser.

Downloads

53

Readme

ejs-serve

GitHub npm

Build, watch and serve your EJS templates in your browser.

👋 Introduction

ejs-serve is a CLI tool for developing/working with EJS templates.

  • renders your EJS templates with data
  • serves the files to your browser
  • watches for file changes and reloads your browser automatically
  • no extra files in your working directory
  • also watches for changes in your data
  • can be used in conjunction with mjml

🚀 Get started

Install ejs-serve globally via npm:

npm install ejs-serve -g

After that ejs-serve is ready to be used 🎉

📚 Usage

Usage: ejs-serve -f <filename> -d <json string|file> -p <port>        

Build, watch and serve your EJS templates in your browser.

Options:
  -f, --file <path>           path to ejs file
  -d, --data <json>           JSON string or path to json file
  -p, --port <number>         port on which to serve the file (default: 8080)
  -e, --email [boolean]       render file with mjml (default: false)
  -o, --open [local/network]  open file in browser automatically (default: false)
  -v, --version               output the version number
  -h, --help                  display help for command

🛠️ Examples

Render EJS template with data from JSON file and serve it

ejs-serve -f index.ejs -d data.json

Render EJS template with data from JSON string and serve it

ejs-serve -f index.ejs -d '{"message":"Hello World!"}'

Serve on custom port

ejs-serve -f index.ejs -d data.json -p 3000

Automatically open browser

ejs-serve can automatically open the file in the browser. If you use -o it will open the file via its local address (localhost:port). You can use -o network to use the network address.

ejs-serve -f index.ejs -d data.json -p 3000 -o

Generate email with mjml

ejs-serve can be used in conjunction with mjml to render your ejs file with data and generate a reponsive email. Use the -e option to enable this feature and it will run the rendered ejs file through mjml.

ejs-serve -f index.ejs -d data.json -e

Use it in another project

If you want to use ejs-serve for development in another project, add it to your dev dependencies:

npm install ejs-serve --save-dev

And include this command in your package.json

  "scripts": {
    "templates": "ejs-serve -f ./path/to/file.ejs -d '{\"message\":\"Hello!\"}'"
  },

📝 To do

Here is what's currently planned for ejs-serve:

  • render multiple files/whole directory
  • render files and output them to directory

💻 Development

Issues and PRs are very welcome!

  • run yarn lint or npm run lint to use eslint.
  • run yarn example or npm run example to serve the example EJS file

Please check out the contributing guide before you start.

This project adheres to Semantic Versioning. To see differences with previous versions refer to the CHANGELOG.

❔ About

This library was developed by me (@betahuhn) in my free time. If you want to support me:

Donate via PayPal

License

Copyright 2020 Maximilian Schiller

This project is licensed under the MIT License - see the LICENSE file for details.