render_stylesheet() — svelte Function Reference
Architecture documentation for the render_stylesheet() function in index.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 1129e6de_ad88_9249_cdc1_424cf9bba55e["render_stylesheet()"] 194b07ed_c18e_6587_618d_b4b4d02442e0["index.js"] 1129e6de_ad88_9249_cdc1_424cf9bba55e -->|defined in| 194b07ed_c18e_6587_618d_b4b4d02442e0 662808dd_8096_e53e_2dc5_8a5903c50472["client_component()"] 662808dd_8096_e53e_2dc5_8a5903c50472 -->|calls| 1129e6de_ad88_9249_cdc1_424cf9bba55e 0accce76_056a_b49e_69ca_069fe7e3e216["transform_component()"] 0accce76_056a_b49e_69ca_069fe7e3e216 -->|calls| 1129e6de_ad88_9249_cdc1_424cf9bba55e b507285b_8f11_234a_936c_682b2ac1e15b["server_component()"] b507285b_8f11_234a_936c_682b2ac1e15b -->|calls| 1129e6de_ad88_9249_cdc1_424cf9bba55e a8fd9736_9ea9_9a69_e694_2cfe2f847ce9["remove_preceding_whitespace()"] 1129e6de_ad88_9249_cdc1_424cf9bba55e -->|calls| a8fd9736_9ea9_9a69_e694_2cfe2f847ce9 cbb1ee69_356b_2015_1118_b75b5cb5088f["merge_with_preprocessor_map()"] 1129e6de_ad88_9249_cdc1_424cf9bba55e -->|calls| cbb1ee69_356b_2015_1118_b75b5cb5088f style 1129e6de_ad88_9249_cdc1_424cf9bba55e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/phases/3-transform/css/index.js lines 29–73
export function render_stylesheet(source, analysis, options) {
const code = new MagicString(source);
/** @type {State} */
const state = {
code,
hash: analysis.css.hash,
minify: analysis.inject_styles && !options.dev,
selector: `.${analysis.css.hash}`,
keyframes: analysis.css.keyframes,
specificity: {
bumped: false
}
};
const ast = /** @type {AST.CSS.StyleSheet} */ (analysis.css.ast);
walk(/** @type {AST.CSS.Node} */ (ast), state, visitors);
code.remove(0, ast.content.start);
code.remove(/** @type {number} */ (ast.content.end), source.length);
if (state.minify) {
remove_preceding_whitespace(ast.content.end, state);
}
const css = {
code: code.toString(),
map: code.generateMap({
// include source content; makes it easier/more robust looking up the source map code
includeContent: true,
// generateMap takes care of calculating source relative to file
source: options.filename,
file: options.cssOutputFilename || options.filename
}),
hasGlobal: analysis.css.has_global
};
merge_with_preprocessor_map(css, options, css.map.sources[0]);
if (dev && options.css === 'injected' && css.code) {
css.code += `\n/*# sourceMappingURL=${css.map.toUrl()} */`;
}
return css;
}
Domain
Subdomains
Source
Frequently Asked Questions
What does render_stylesheet() do?
render_stylesheet() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/3-transform/css/index.js.
Where is render_stylesheet() defined?
render_stylesheet() is defined in packages/svelte/src/compiler/phases/3-transform/css/index.js at line 29.
What does render_stylesheet() call?
render_stylesheet() calls 2 function(s): merge_with_preprocessor_map, remove_preceding_whitespace.
What calls render_stylesheet()?
render_stylesheet() is called by 3 function(s): client_component, server_component, transform_component.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free