@microlink/cards

1.13.78 • Public • Published

@microlink/cards

Generate Microlink Cards on build time.

Install

$ npm install @microlink/cards --save

Usage

const microlinkCards = require('@microlink/cards')
const slugify = require('@sindresorhus/slugify')

const build = async () =>
  microlinkCards({
    // An entry per every card that will be generated
    entries: [
      {
        preset: 'rauchg',
        title: 'hello world'
      }
    ],
    // Any Microlink API option can be passed
    // See: https://microlink.io/api
    mqlOpts: {
      apiKey: process.env.MICROLINK_API_KEY
    },
    output: {
      // The filename is determined using the entry
      filename: ({ title }) => slugify(title),
      // The output directory where cards will be written
      path: 'dist/images/cards',
      // Builds are incremental by default
      // only new cards will be generated.
      incremental: true
    }
  })

build()
  .then(outputFiles => console.log(outputFiles))
  .catch(error => console.error(error) || process.exit(1))

License

microlink-cards © Microlink, released under the MIT License.
Authored and maintained by Kiko Beats with help from contributors.

microlink.io · GitHub microlinkhq · Twitter @microlinkhq

Package Sidebar

Install

npm i @microlink/cards

Weekly Downloads

2

Version

1.13.78

License

MIT

Unpacked Size

5.6 kB

Total Files

4

Last publish

Collaborators

  • kikobeats