Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/core/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,33 @@ declare module '*?inline' {
export default content;
}

/**
* Raw css
*/
declare module '*.css?raw' {
const content: string;
export default content;
}
declare module '*.scss?raw' {
const content: string;
export default content;
}
declare module '*.sass?raw' {
const content: string;
export default content;
}
declare module '*.less?raw' {
const content: string;
export default content;
}
declare module '*.styl?raw' {
const content: string;
export default content;
}
declare module '*.stylus?raw' {
const content: string;
export default content;
}

/**
* CSS Modules
Expand Down
4 changes: 4 additions & 0 deletions website/docs/en/guide/basic/css-usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,7 @@ Using `import "*.css?raw"` has the following behaviors:
- Get the raw text content of the CSS file, without any preprocessing or compilation
- The content of the CSS file will be inlined into the final JavaScript bundle
- No separate CSS file will be generated

:::tip
Rsbuild's Sass, Less, and Stylus plugins also support the `?raw` query parameter.
:::
4 changes: 4 additions & 0 deletions website/docs/zh/guide/basic/css-usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,7 @@ console.log(rawCss); // 输出 CSS 文件的原始内容
- 获取 CSS 文件的原始文本内容,不经过任何预处理或编译
- 内容会作为字符串内联到最终的 JavaScript 包中
- 不会生成单独的 CSS 文件

:::tip
Rsbuild 的 Sass、Less 和 Stylus 插件也支持 `?raw` 查询参数。
:::
Loading