mariordev / mailtoui

A simple way to enhance your mailto links with a convenient user interface.
https://mailtoui.com
MIT License
192 stars 12 forks source link

how to use this through npm ? #18

Closed roeniss closed 4 years ago

roeniss commented 4 years ago

Hi.

i think main docs doesn't provide adequate amount of guide of how to use mailtoui with npm.

Can you explain a little bit more?

// after `npm i mailtoui@1.0.3` :
import mailtoui from "mailtoui"
const mailtoui = require("mailtoui")

Both doens't work. Just Module not found same error was invoked.

Best, Roeniss

mariordev commented 4 years ago

Hi, thanks for reaching out. After installing MailtoUI via npm, you only need to require it in your code, like so:

const MailtoUI = require('path/to/your/node_modules/mailtoui/dist/mailtoui-min.js')

This will make the run method available, so you can call it where appropriate in your code, like so:

MailtoUI.run()

The run method can optionally accept an object with any of the options supported (https://mailtoui.com/#options), like so:

MailtoUI.run({ "autoClose": false })

This is explained in the Usage section (https://mailtoui.com/#usage), under "Running MailtoUI manually"

Hope this helps!