这是开发预览网站。请访问正式文档 lynxjs.org

Home > @lynx-js/rspeedy > Output > dataUriLimit

Output.dataUriLimit property

The Output.dataUriLimit option is used to set the size threshold to inline static assets such as images and fonts.

Signature:

dataUriLimit?: number | DataUriLimit | undefined;

Default Value

2048

Example 1

Inline all static assets less than 4kB:

import { defineConfig } from '@lynx-js/rspeedy'
export default defineConfig({
  output: {
    dataUriLimit: 4 * 1024,
  },
})

Example 2

Disable inlining of static assets:

import { defineConfig } from '@lynx-js/rspeedy'
export default defineConfig({
  output: {
    dataUriLimit: 0,
  },
})

Example 3

Inline all static assets:

import { defineConfig } from '@lynx-js/rspeedy'
export default defineConfig({
  output: {
    dataUriLimit: Number.MAX_SAFE_INTEGER,
  },
})

Example 4

Disable inlining of all media but not images.

lynx.config.ts
import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
  output: {
    dataUriLimit: {
      image: 5000,
      media: 0,
    },
  },
})