Skip to content

Commit 2c42f5b

Browse files
authored
docs: update raw import JSDoc to include scripts (#5544)
1 parent 084eaf9 commit 2c42f5b

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

packages/core/types.d.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ declare module '*?url' {
233233
* @example
234234
* import logo from './logo.svg?inline'
235235
* console.log(logo) // 'data:image/svg+xml;base64,...'
236+
*
237+
* import inlineCss from './style.css?inline';
238+
* console.log(inlineCss); // Compiled CSS content
236239
*/
237240
declare module '*?inline' {
238241
const content: string;
@@ -241,10 +244,17 @@ declare module '*?inline' {
241244

242245
/**
243246
* Imports the raw content of the file as a string.
244-
* @note Only works for static assets and CSS files by default.
247+
* @note Only works for static assets, CSS files, and scripts
248+
* (JS, TS, JSX, TSX) by default.
245249
* @example
246250
* import raw from './logo.svg?raw'
247251
* console.log(raw) // '<svg viewBox="0 0 24 24">...</svg>'
252+
*
253+
* import rawJs from './script.js?raw'
254+
* console.log(rawJs) // 'console.log("Hello world");'
255+
*
256+
* import rawCss from './style.css?raw'
257+
* console.log(rawCss) // 'body { background: red; }'
248258
*/
249259
declare module '*?raw' {
250260
const content: string;

website/docs/en/guide/styling/css-usage.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ Rsbuild supports importing compiled CSS files as strings in JavaScript by using
166166
```js
167167
import inlineCss from './style.css?inline';
168168

169-
console.log(inlineCss); // Output the compiled CSS file content
169+
console.log(inlineCss); // Compiled CSS content
170170
```
171171

172172
Using `import "*.css?inline"` has the following behaviors:

website/docs/zh/guide/styling/css-usage.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ Rsbuild 支持通过 `?inline` 查询参数引用 CSS 文件编译后的内容
166166
```js
167167
import inlineCss from './style.css?inline';
168168

169-
console.log(inlineCss); // 输出编译后的 CSS 文件内容
169+
console.log(inlineCss); // 编译后的 CSS 内容
170170
```
171171

172172
使用 `import "*.css?inline"` 的行为如下:

0 commit comments

Comments
 (0)