Skip to content
On this page

Extractors

Extractors are used to extract the usage of utilities from your source code.

ts
// uno.config.ts
import { defineConfig } from 'unocss'

export default defineConfig({
  extractors: [
    // your extractors
  ],
})
// uno.config.ts
import { defineConfig } from 'unocss'

export default defineConfig({
  extractors: [
    // your extractors
  ],
})

By default extractorSplit will always be applied, which split the source code into tokens and directly feed to the engine.

To override the default extractors, you can use extractorDefault option.

ts
// uno.config.ts
import { defineConfig } from 'unocss'

export default defineConfig({
  extractors: [
    // your extractors
  ],
  // disable the default extractor
  extractorDefault: false,
  // override the default extractor with your own
  extractorDefault: myExtractor,
})
// uno.config.ts
import { defineConfig } from 'unocss'

export default defineConfig({
  extractors: [
    // your extractors
  ],
  // disable the default extractor
  extractorDefault: false,
  // override the default extractor with your own
  extractorDefault: myExtractor,
})

For example, you could check how we implement the pug extractor or the attributify extractor.

Released under the MIT License.