Update Node.js docs
This commit is contained in:
parent
385149df3b
commit
98409074ae
|
@ -8,6 +8,14 @@ export type Cfg = { __doNotUseCfgDirectly: string & { __itIsANapiExternalValue:
|
|||
* @returns An opaque value that can be passed to minify functions
|
||||
*/
|
||||
export function createConfiguration (options: {
|
||||
/** Do not omit closing tags when possible. */
|
||||
keep_closing_tags?: boolean;
|
||||
/** Do not omit `<html>` and `<head>` opening tags when they don't have attributes. */
|
||||
keep_html_and_head_opening_tags?: boolean;
|
||||
/** Keep spaces between attributes when possible to conform to HTML standards. */
|
||||
keep_spaces_between_attributes?: boolean;
|
||||
/** Keep all comments. */
|
||||
keep_comments?: boolean;
|
||||
/**
|
||||
* If enabled, content in `<script>` tags with a JS or no [MIME type](https://mimesniff.spec.whatwg.org/#javascript-mime-type) will be minified using [esbuild-rs](https://github.com/wilsonzlin/esbuild-rs).
|
||||
*/
|
||||
|
@ -16,11 +24,14 @@ export function createConfiguration (options: {
|
|||
* If enabled, CSS in `<style>` tags will be minified using [esbuild-rs](https://github.com/wilsonzlin/esbuild-rs).
|
||||
*/
|
||||
minifyCss?: boolean;
|
||||
/** Remove all bangs. */
|
||||
remove_bangs?: boolean;
|
||||
/** Remove all processing_instructions. */
|
||||
remove_processing_instructions?: boolean;
|
||||
}): Cfg;
|
||||
|
||||
/**
|
||||
* Minifies a string containing HTML code.
|
||||
* Throws an {@link Error} if the source code cannot be minified, with a `position` property representing the position of the character in the source code that caused the error.
|
||||
*
|
||||
* @param src - Source HTML code
|
||||
* @param cfg - Configuration created by {@link createConfiguration}
|
||||
|
@ -30,7 +41,6 @@ export function minify (src: string, cfg: Cfg): Buffer;
|
|||
|
||||
/**
|
||||
* Minifies a {@link Buffer} containing UTF-8 HTML code in place.
|
||||
* Throws an {@link Error} if the source code cannot be minified, with a `position` property representing the position of the character in the source code that caused the error.
|
||||
*
|
||||
* @param code - Source Buffer code
|
||||
* @param cfg - Configuration created by {@link createConfiguration}
|
||||
|
|
|
@ -1,20 +1,6 @@
|
|||
/// Configuration settings that can be adjusted and passed to a minification function to change the
|
||||
/// minification approach.
|
||||
pub struct Cfg {
|
||||
/// If enabled, JavaScript in `<script>` tags are minified using
|
||||
/// [esbuild-rs](https://github.com/wilsonzlin/esbuild-rs). The `js-esbuild` feature must be
|
||||
/// enabled; otherwise, this value has no effect.
|
||||
///
|
||||
/// Only `<script>` tags with a valid or no
|
||||
/// [MIME type](https://mimesniff.spec.whatwg.org/#javascript-mime-type) is considered to
|
||||
/// contain JavaScript, as per the specification.
|
||||
pub minify_js: bool,
|
||||
|
||||
/// If enabled, CSS in `<style>` tags are minified using
|
||||
/// [esbuild-rs](https://github.com/wilsonzlin/esbuild-rs). The `js-esbuild` feature must be
|
||||
/// enabled; otherwise, this value has no effect.
|
||||
pub minify_css: bool,
|
||||
|
||||
/// Do not omit closing tags when possible.
|
||||
pub keep_closing_tags: bool,
|
||||
/// Do not omit `<html>` and `<head>` opening tags when they don't have attributes.
|
||||
|
@ -23,6 +9,18 @@ pub struct Cfg {
|
|||
pub keep_spaces_between_attributes: bool,
|
||||
/// Keep all comments.
|
||||
pub keep_comments: bool,
|
||||
/// If enabled, CSS in `<style>` tags are minified using
|
||||
/// [esbuild-rs](https://github.com/wilsonzlin/esbuild-rs). The `js-esbuild` feature must be
|
||||
/// enabled; otherwise, this value has no effect.
|
||||
pub minify_css: bool,
|
||||
/// If enabled, JavaScript in `<script>` tags are minified using
|
||||
/// [esbuild-rs](https://github.com/wilsonzlin/esbuild-rs). The `js-esbuild` feature must be
|
||||
/// enabled; otherwise, this value has no effect.
|
||||
///
|
||||
/// Only `<script>` tags with a valid or no
|
||||
/// [MIME type](https://mimesniff.spec.whatwg.org/#javascript-mime-type) is considered to
|
||||
/// contain JavaScript, as per the specification.
|
||||
pub minify_js: bool,
|
||||
/// Remove all bangs.
|
||||
pub remove_bangs: bool,
|
||||
/// Remove all processing_instructions.
|
||||
|
|
Loading…
Reference in New Issue