How to use the juice.heightElements function in juice

To help you get started, we’ve selected a few juice examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github maizzle / framework / src / transformers / inline.js View on Github external
module.exports = async (html, config) => {
  const options = config.inlineCSS

  if (options && options.enabled) {
    if (options.styleToAttribute) {
      juice.styleToAttribute = options.styleToAttribute || juice.styleToAttribute
    }

    if (typeof options.applySizeAttribute === 'object') {
      juice.widthElements = typeof options.applySizeAttribute.width === 'object' ? Object.values(options.applySizeAttribute.width) : juice.widthElements
      juice.heightElements = typeof options.applySizeAttribute.height === 'object' ? Object.values(options.applySizeAttribute.height) : juice.heightElements
    }

    if (options.excludedProperties) {
      juice.excludedProperties = typeof options.excludedProperties === 'object' ? Object.values(options.excludedProperties) : juice.excludedProperties
    }

    if (options.codeBlocks) {
      Object.entries(options.codeBlocks).forEach(
        ([k, v]) => juice.codeBlocks[k] = v // eslint-disable-line
      )
    }

    return juice(html, { removeStyleTags: true })
  }

  return html
github maizzle / maizzle-php / tasks / js / after-jigsaw.js View on Github external
files.map((file) => {

    let html = fs.readFileSync(file, 'utf8');

    if (inlineOpts.enabled) {
      if (inlineOpts.styleToAttribute) {
        juice.styleToAttribute = inlineOpts.styleToAttribute || juice.styleToAttribute;
      }

      if (inlineOpts.applySizeAttribute) {
        juice.widthElements = inlineOpts.applySizeAttribute.width || juice.widthElements;
        juice.heightElements = inlineOpts.applySizeAttribute.height || juice.heightElements;
      }

      if (inlineOpts.excludedProperties) {
        juice.excludedProperties = inlineOpts.excludedProperties || juice.excludedProperties;
      }

      if (inlineOpts.codeBlocks) {
        Object.entries(inlineOpts.codeBlocks).forEach(
            ([k, v]) => juice.codeBlocks[k] = v
        );
      }

      html = juice(html, {removeStyleTags: removeStyleTags});
    }

    if (cleanupOpts.removeUnusedCss.enabled) {