Skip to main content

Crate oj_css

Crate oj_css 

Source
Expand description

oj’s stylesheet pipeline: lightningcss for CSS (modules, lowering, url rebasing), grass for Sass, and postcss-import style @import inlining, each resolving specifiers the way Vite does.

Structs§

CssModulesOptions
Vite’s css.modules (postcss-modules) options oj applies.
CssOutput
CssResolve
How specifiers inside a stylesheet resolve beyond plain relative paths, as Vite’s CSS resolvers do: resolve.alias applies to @import, @use and url(), and a root-absolute /src/x resolves against the root, with the public directory taking precedence.
CssResolveConfig
Owned CssResolve for holders that outlive a borrow.
SassOptions
How a Sass stylesheet is compiled: the importer’s directory, configured loadPaths, the node_modules above it, additionalData, and alias / root-absolute resolution.

Functions§

browser_targets
esbuild-style targets as lightningcss browsers, like Vite’s convertTargets: the lowest version per browser wins, non-browser names (es2020, node18) are skipped, and no browser at all means the baseline.
compile_css
compile_css_dev
The dev-server compile: urls rebased to server-absolute ones, aliased ones to the url of the file they name, as Vite’s url rewriter does.
compile_css_rebased
compile_css_rebased_with_map
compile_css_rebased plus an inline source map back to url.
compile_css_with
The build compile: build.cssMinify and build.cssTarget from resolve.
compile_sass
compile_sass_collecting
compile_sass_opts, appending every stylesheet loaded to deps (sass’s includedFiles, Vite’s HMR dependencies for the sheet).
compile_sass_opts
compile_sass_with
css_modules_esm
The JS module for a class map, shaped like Vite’s dataToEsm(map, { namedExports: true }): the map is the default export and every legal identifier is also a named export.
inline_imports
Inline plain @imports so the stylesheet carries the imported rules. Relative imports resolve against the importer, bare ones through node_modules (style / main entry). layer(...), supports(...) and external imports stay as written; inlined files’ urls are rebased to file’s directory.
inline_imports_collecting
inline_imports_with, appending every inlined file to deps (Vite’s HMR dependencies for the sheet).
inline_imports_with
inline_imports with aliases and root-absolute specifiers.
is_css_module
is_sass
node_modules_load_paths
Every node_modules directory from dir up to the filesystem root, nearest first.
resolve_css_import
postcss-import’s order: relative to the importer, then a node_modules package (its style / main entry, or a file inside it); ~ accepted.
resolve_css_import_with
resolve_css_import after Vite’s alias and root-absolute steps. A path alias resolves there, a package alias continues as a bare specifier; /x is the public file, else a file under the root, else a real absolute path.