How to use the @open-wc/building-utils/index-html.minifyIndexHTML function in @open-wc/building-utils

To help you get started, we’ve selected a few @open-wc/building-utils 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 open-wc / open-wc / packages / webpack-index-html-plugin / src / emit-index-html.js View on Github external
finalIndexHTML,
          variation.toString(),
          variation === VARIATION_FALLBACK,
        );
      }

      generateResult.files.forEach(file => {
        compilation.assets[file.path] = {
          source: () => file.content,
          size: () => file.content.length,
        };
      });
    } else {
      /** If injection is disabled the user takes control, probably with it's own template. */
      const serialized = serialize(localBaseIndex);
      finalIndexHTML = minifyIndexHTML(serialized);
    }

    compilation.assets[filename] = {
      source: () => finalIndexHTML,
      size: () => finalIndexHTML.length,
    };
  };
github open-wc / open-wc / packages / rollup-plugin-index-html / src / create-output.js View on Github external
*/
  if (pluginConfig.inject) {
    const result = createIndexHTML(inputIndexHTML, {
      ...pluginConfig,
      entries,
      legacyEntries,
    });

    return [{ path: pluginConfig.indexFilename, content: result.indexHTML }, ...result.files];
  }

  /**
   * If injection is disabled the user takes control, probably with it's own template.
   */
  const serialized = serialize(inputIndexHTML);
  return [{ path: pluginConfig.indexFilename, content: minifyIndexHTML(serialized) }];
}