Skip to content

Options

crossorigin

  • Type: String, Boolean
    • Default: 'anonymous'
    • Valid values: anonymous, use-credentials, '', true, false

Sets the global crossorigin value of the Nuxt Speedkit preloads.
The default value is the crossorigin value from the Render Configuration.

Set false to disable the crossorigin.

MDN - HTML.Attributes.crossorigin

optimizePreloads

  • Type: Boolean
    • Default: true

Activating this option optimizes the initial script preloads and removes unnecessary loads.

The following NuxtJS settings are made or overwritten in the nuxt.config:

PropertyValue
nuxt.options.vite.build.manifestfalse
nuxt.options.noScriptstrue

detection

  • Type: Object

These options can be used to define the initial checks to display the SpeedkitLayer. The prerequisite are that the SpeedkitLayer has been embedded into the layout.

js
{
  performance: true,
  browserSupport: true
}
KeyTypeRequiredDescriptionDefault
performanceBooleanyesChecking whether the minimum characteristic values have been reached. If the test is negative, the SpeedkitLayer will be displayed.true
browserSupportBooleanyesCheck if the current browser on client side is supported. If the test is negative, the SpeedkitLayer will be displayed.true

INFO

For the browser support detection, the default Browserslist of the NuxtJS configuration is used.

performanceMetrics

  • Type: Object

With the help of the metrics, the actual performance check on client side can be configured.

js
{
  device: {
    hardwareConcurrency: { min: 2, max: 48 },
    deviceMemory: { min: 2 }
  },
  timing: {
    fcp: 800,
    dcl: 1200 // fallback if fcp is not available (safari)
  }
}

device

  • Type: Object

Definition of the minimum hardware requirements for visiting the website.

js
{
  hardwareConcurrency: { min: 2, max: 48 },
  deviceMemory: { min: 2 }
}
KeyTypeRequiredDescriptionDefault
hardwareConcurrencyObjectyesmin/max number of CPUs{ min: 2, max: 48 }
deviceMemoryObjectyesmin size of memory{ min: 2 }

timing

  • Type: Object

Definition of the max. FCP duration (ms). If the specified value is exceeded, the SpeedkitLayer will be displayed. If the browser does not grant access to the FCP, as fallback the DCL will be evaluated.

js
{
  fcp: 800,
  dcl: 1200 // fallback if fcp is not available (safari)
}
KeyTypeRequiredDescriptionDefault
fcpNumberyesMax. FCP duration in ms learn More800
dclNumberyesMax. DCL duration in ms1200

fonts

  • Type: Array

List of all font families used in the project. Only the fonts that are listed in the configuration can be retrieved and integrated via $fonts.getFont(...).

js
[
  {
    family: 'Font A',
    locals: ['Font A'],
    fallback: ['Arial', 'sans-serif'],
    variances: […]
  },
  {
    family: 'Font B',
    locals: ['Font B'],
    fallback: ['Arial', 'sans-serif'],
    variances: […]
  }
]

Font-Family

  • Type: Object

Describes a font family with all its variants.

js
{
  family: 'Font A',
  locals: ['Font A'],
  fallback: ['Arial', 'sans-serif'],
  variances: […]
}
KeyTypeRequiredDescription
familyStringyesname of the font family
localsArrayyessystem font name of the specified font family
fallbackArrayyesfallback fonts e.g. ['Arial', 'sans-serif']
variancesArrayyeslist of font family variants (e.g. Bold, Italic)

WARNING

Prevent sizing discrepancy between your custom and fallback font for perfect swap and reduction of layout shifts. Learn more

Font-Variance

  • Type: Object

A font variant describes an instance of a font family and is used to generate the FontFace declaration. Font variants differ in style and weight.

js
{
  style: 'normal',
  weight: 400,
  sources: [
    { src: '@/assets/fonts/font-a-regular.woff', type:'woff' },
    { src: '@/assets/fonts/font-a-regular.woff2', type:'woff2' }
  ]
}
KeyTypeRequiredDescription
styleStringyesfont-style of FontFace, e.g. normal, italic
weightString or Numberyesfont-weight of FontFace, e.g. 400, normal
sourcesArrayyeslist of all font files assigned to the variant (sources)

sources

  • Type: Array

List of all available font files of a font family variation.

js
[
  { src: '@/assets/fonts/font-a-regular.woff', type:'woff' },
  { src: '@/assets/fonts/font-a-regular.woff2', type:'woff2' }
]
KeyTypeRequiredValue
srcStringyespath to a font file, the use of aliases is possible
typeStringyesfile format of the specified file, e.g. woff, woff2, …

targetFormats

  • Type: Array
    • Default: ['webp', 'avif', 'jpg|jpeg|png|gif']

Sets the default formats for the SpeedkitPicture.

Can be overridden in the SpeedkitPicture via the formats property.

For png, jpeg and gif formats we have added the | operator in the declaration.
This adjusts the destination format to the source format.

Example

Bad

The declaration below generates a png, jpeg and gif (destination format) for each jpeg (source format). The same applies to a png and a gif as source format. However, this is not practical for the source specifications in the Picture.

js
{
  targetFormats: ['jpg', 'jpeg', 'png', 'gif']
}

Good

Based on the source format, the appropriate target format is created using the declaration described below.

js
{
  targetFormats: ['jpg|jpeg|png|gif']
}

INFO

For the avif and webp formats the | operator is not needed, because these two image formats do not depend on the source format, as it is the case for png, jpeg and gif.

lazyOffset

  • Type: Object

Global option for the IntersectionObserver built into the Nuxt Speedkit.

js
{
  component: '0%',
  asset: '0%' 
}
KeyTypeRequiredDescriptionDefault
componentStringyesrootMargin value for SpeedkitHydrate.0%
assetStringyesrootMargin value for all static ressources (v-font, SpeedkitPicture & SpeedkitImage).0%

disableNuxtFontaine

  • Type: Boolean
    • Default: false

If set, @nuxtjs/fontaine will not be integrated.

disableNuxtImage

  • Type: Boolean
    • Default: false

If set, @nuxt/image will not be integrated.

DANGER

Note that the use of SpeedkitImage, SpeedkitPicture, SpeedkitVimeo and SpeedkitYoutube is not supported if @nuxt/image is not integrated.