Skip to content

Commit c368d01

Browse files
authored
docs: update lucide-static documentation about raw string imports (#3524)
1 parent 9942702 commit c368d01

1 file changed

Lines changed: 25 additions & 8 deletions

File tree

docs/guide/packages/lucide-static.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,21 @@ Make sure you have the correct Webpack loader configured, such as [`url-loader`]
101101

102102
To import an SVG as a string (e.g., for templating):
103103

104-
```js
104+
::: code-group
105+
106+
```js [Webpack]
105107
import arrowRightIcon from 'lucide-static/icons/arrow-right';
106108
```
107109

110+
```js [Vite]
111+
import arrowRightIcon from 'lucide-static/icons/arrow-right.svg?raw';
112+
```
113+
114+
:::
115+
108116
You'll need an SVG loader like [`svg-inline-loader`](https://v4.webpack.js.org/loaders/svg-inline-loader/).
109117

118+
110119
### Using the SVG sprite
111120

112121
:::danger
@@ -208,19 +217,27 @@ If you're not using a package manager, you can download the font files directly
208217

209218
## Node.js
210219

211-
You can also import Lucide icons in Node.js (CommonJS) projects:
220+
You can also import Lucide icons in Node.js projects:
212221

213-
```js
214-
const {messageSquare} = require('lucide-static/lib');
222+
::: code-group
223+
224+
```js [ESM]
225+
import {MessageSquare} from 'lucide-static';
215226
```
216227

217-
> Note: Each icon name is in camelCase.
228+
```js [CommonJs]
229+
const {MessageSquare} = require('lucide-static');
230+
```
231+
232+
:::
233+
234+
> Note: Each icon name is in PascalCase.
218235
219236
#### Express app example in Node.js
220237

221238
```js
222-
const express = require('express');
223-
const {messageSquare} = require('lucide-static/lib');
239+
import express from 'express';
240+
import {MessageSquare} from 'lucide-static';
224241
const app = express();
225242
const port = 3000;
226243

@@ -233,7 +250,7 @@ app.get('/', (req, res) => {
233250
</head>
234251
<body>
235252
<h1>Lucide Icons</h1>
236-
<p>This is a Lucide icon ${messageSquare}</p>
253+
<p>This is a Lucide icon ${MessageSquare}</p>
237254
238255
</body>
239256
</html>

0 commit comments

Comments
 (0)