README
@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) && process.exit())
.catch(err => console.error(err) && 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