emails-renderer/webpack-utils/text2png-loader/index.js

17 lines
368 B
JavaScript
Raw Normal View History

2019-05-10 04:23:28 +05:30
/* 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);
};