MCPcopy
hub / github.com/webpack/webpack / _renderCss

Method _renderCss

lib/css/CssGenerator.js:855–882  ·  view source on GitHub ↗

* Generate CSS source for the current module * @param {NormalModule} module the module to generate CSS source for * @param {GenerateContext} generateContext the generate context * @returns {Source | null} the CSS source

(module, generateContext)

Source from the content-addressed store, hash-verified

853 * @returns {Source | null} the CSS source
854 */
855 _renderCss(module, generateContext) {
856 const moduleSourceContent = /** @type {Source} */ (
857 this.generate(module, {
858 ...generateContext,
859 type: CSS_TYPE
860 })
861 );
862
863 if (!moduleSourceContent) {
864 return null;
865 }
866
867 const compilation = generateContext.runtimeTemplate.compilation;
868 const undoPath = "";
869
870 const CssModulesPlugin = getCssModulesPlugin();
871 const hooks = CssModulesPlugin.getCompilationHooks(compilation);
872 return CssModulesPlugin.renderModule(
873 /** @type {CssModule} */ (module),
874 {
875 undoPath,
876 moduleSourceContent,
877 moduleFactoryCache: this._moduleFactoryCache,
878 runtimeTemplate: generateContext.runtimeTemplate
879 },
880 hooks
881 );
882 }
883
884 /**
885 * Convert a CSS Source into a JS string literal, splicing `__webpack_require__.h()` for `[fullhash]` placeholders.

Callers 2

generateContentCodeMethod · 0.95
_renderMergedCssMethod · 0.95

Calls 3

generateMethod · 0.95
getCompilationHooksMethod · 0.45
renderModuleMethod · 0.45

Tested by

no test coverage detected