This package has been deprecated

Author message:

Use @master/css-extractor to set up static extraction

@master/css-compiler
TypeScript icon, indicating that this package has built-in type declarations

2.0.0-beta.98 • Public • Published

Master CSS

The ahead-of-time compiler of Master CSS

NPM Version NPM Version NPM package ( download / month ) Discord online Follow @mastercorg Github release actions

Usage

npm install @master/css-compiler
const compiler = new MasterCSSCompiler()

Options

{
    // specify virtual CSS module id (e.g. virtual:master.css)
    module: 'master.css',
    // specify config file path or set `Config`
    config: 'master.css.{ts,js,mjs,cjs}',
    // forcibly specify sources for scanning, not excluded by `options.exclude`
    sources: [],
    // specify sources for scanning
    include: ['**/*.{html,js,jsx,ts,tsx,svelte,astro,vue,md,mdx,pug,php}'],
    // specify sources to exclude
    exclude: [
        '**/node_modules/**',
        '**/*.d.ts',
        '**/*.test.*',
        'node_modules',
        'master.css.{js,ts,mjs,cjs}',
        'dist',
        'out',
        'README.md'
    ],
    // whitelist of class names for unpredictable dynamics
    fixedClasses: [],
    // blacklist of class names to exclude accidentally captured
    ignoredClasses: [], // or RegExp[]
    cwd: process.cwd()
}

Methods

// Initialize the compiler and MasterCSS
init(): this
// Scan sources, extract class names, and generate CSS rules
compile()
// Extract potential class names from the given file content
extract(name: string, content: string): string[]
// `extract(name, content)`, insert extractions, and generate CSS rules
insert(name: string, content: string): boolean
// Read file source paths by `options.include` and `options.exclude`
get sources(): string[]
// Check source file path by `options.include` and `options.exclude`
checkSourcePath(name: string): boolean
// Read user config file by `options.config`
readConfig(): Config
// Get user config path
get configPath(): string
// Get resolved user config path
get resolvedConfigPath(): string

Properties

export default class MasterCSSCompiler {
    css: MasterCSS
    extractions = new Set<string>()
    ...
}

Package Sidebar

Install

npm i @master/css-compiler

Weekly Downloads

12

Version

2.0.0-beta.98

License

MIT

Unpacked Size

46.7 kB

Total Files

8

Last publish

Collaborators

  • 1aron
  • benseage0