Options
All
  • Public
  • Public/Protected
  • All
Menu

@assemblylanguage/source-code-minifier

Index

Variables

plugins

plugins: { minifyCssPlugin: (humble: any) => Promise<void>; minifyGenericTagNamesPlugin: (humble: any) => Promise<void>; minifyHtmlPlugin: (humble: any) => Promise<void>; minifyJsPlugin: (humble: any) => Promise<void> } = ...

Type declaration

  • minifyCssPlugin: (humble: any) => Promise<void>
      • (humble: any): Promise<void>
      • A plugin wrapper for the minifyCss function.

        Parameters

        • humble: any

          a Humble object that will be modified in place.

        Returns Promise<void>

  • minifyGenericTagNamesPlugin: (humble: any) => Promise<void>
      • (humble: any): Promise<void>
      • A plugin wrapper for the minifyGenericTagNames function.

        Parameters

        • humble: any

          a Humble object that will be modified in place.

        Returns Promise<void>

  • minifyHtmlPlugin: (humble: any) => Promise<void>
      • (humble: any): Promise<void>
      • A plugin wrapper for the minifyHtml function.

        Parameters

        • humble: any

          a Humble object that will be modified in place.

        Returns Promise<void>

  • minifyJsPlugin: (humble: any) => Promise<void>
      • (humble: any): Promise<void>
      • A plugin wrapper for the minifyJs function.

        Parameters

        • humble: any

          a Humble object that will be modified in place.

        Returns Promise<void>

Functions

minifyCss

  • minifyCss(document: Document, options: any): void
  • Minifies the CSS in all <style> tags and all inline style attributes in the document. The implementation is from the clean-css library.

    command

    --minify-css

    example
    // The unminified CSS before running the minifier:
    //
    // <html>
    // <head>
    // <style>
    // .hello {
    // color: #fff;
    // }
    // </style>
    // </head>
    // </html>

    // Minifying the document CSS.
    minifyCss(document, options);

    // After running the minifier, the CSS will be minified:
    //
    // <html>
    // <head>
    // <style>.hello{color:#fff}</style>
    // </head>
    // </html>
    see

    https://www.npmjs.com/package/clean-css

    Parameters

    • document: Document

      the document that will be modified in place.

    • options: any

      the options used within the clean-css library.

    Returns void

minifyGenericTagNames

  • minifyGenericTagNames(document: Document): void
  • Minifies generic tag names that have no HTML semantic meaning. Currently the algorithm used to minify generic tag names minifies the following tags:

    • <div> -> <d>
    • <span> -> <n>
    command

    --minify-generic-tag-names

    example
    // The unminified HTML before running the minifier:
    //
    // <html>
    // <body>
    // <div></div>
    // <span></div>
    // </body>
    // </html>

    // Minifying the document generic tag names.
    minifyGenericTagNames(document);

    // After running the minifier, generic tag names will be minified:
    //
    // <html>
    // <body>
    // <d></d>
    // <n></n>
    // </body>
    // </html>

    Parameters

    • document: Document

      the document that will be modified inplace.

    Returns void

minifyHtml

  • minifyHtml(html: string, options: any): string
  • Minifies HTML. The implementation is from the html-minifier library.

    command

    --minify-html

    example
    // The unminified HTML before running the minifier:
    //
    // <html>
    // <head>
    // </head>
    // <body>
    // <p>Hello, World</p>
    // </body>
    // </html>

    // Minifying the document HTML.
    minifyHtml(html, options);

    // After running the minifier, the HTML will be minified:
    //
    // <html><head></head><body><p>Hello, World</p></body></html>
    see

    https://www.npmjs.com/package/html-minifier

    Parameters

    • html: string

      the html that will be minified.

    • options: any

      the options used within the html-minifier library.

    Returns string

    the minified HTML.

minifyJs

  • minifyJs(document: Document, options: any): Promise<void>
  • Minifies the JavaScript in all <script> tags, in all inline script attributes in the document, and all javascript: protocols. The implementation is from the terser library.

    command

    --minify-js

    example
    // The unminified JS before running the minifier:
    //
    // <html>
    // <head>
    // <script>
    // console.log(
    // 'Hello, World'
    // );
    // </script>
    // </head>
    // <html>

    // Minifying the document JS.
    minifyJs(document, options);

    // After running the minifier, the JS will be minified:
    //
    // <html>
    // <script>console.log('Hello, World')</script>
    // <html>
    see

    https://www.npmjs.com/package/terser

    Parameters

    • document: Document

      the document that will be modified in place.

    • options: any

      the options used within the terser library.

    Returns Promise<void>

Generated using TypeDoc