emails-renderer/webpack-utils/text2png-loader/index.js
2019-05-10 01:53:28 +03:00

17 lines
368 B
JavaScript

/* eslint-env node */
const { getOptions } = require('loader-utils');
const text2png = require('text2png');
module.exports = function() {
this.cacheable && this.cacheable();
const { text, ...options } = getOptions(this);
if (!text) {
this.emitError('The text param is required');
return '';
}
return text2png(text, options);
};