Skip to content

Commit b124ed7

Browse files
update CSP build/installation docs (#3762)
there has been a lot of confusion on how to use the CSP build, so this commit hopefully clears them up, and provides more explicit instructions on how to "build from source". some of the wording and code examples make it seem like an NPM package is available, so we'll update that to avoid confusion. Co-authored-by: Caleb Porzio <[email protected]>
1 parent 1e72dfb commit b124ed7

File tree

1 file changed

+10
-3
lines changed
  • packages/docs/src/en/advanced

1 file changed

+10
-3
lines changed

packages/docs/src/en/advanced/csp.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,29 @@ In order to accommodate environments where this CSP is necessary, Alpine will of
1414
<a name="installation"></a>
1515
## Installation
1616

17-
The CSP build hasn't been officially released yet. In the meantime, you may [build it from source](https://github.com/alpinejs/alpine/tree/main/packages/csp). Once released, like all Alpine extensions, you will be able to include this either via `<script>` tag or module import:
17+
The CSP build hasn’t been officially released yet. In the meantime, you may build it from source. To do this, clone the [`alpinejs/alpine`](https://github.com/alpinejs/alpine) repository and run:
18+
19+
```shell
20+
npm install
21+
npm run build
22+
```
23+
24+
This will generate a `/packages/csp/dist/` directory with the built files. After copying the appropriate file into your project, you can include it either via `<script>` tag or module import:
1825

1926
<a name="script-tag"></a>
2027
### Script tag
2128

2229
```alpine
2330
<html>
24-
<script src="alpinejs/alpinejs-csp/cdn.js" defer></script>
31+
<script src="/path/to/cdn.js" defer></script>
2532
</html>
2633
```
2734

2835
<a name="module-import"></a>
2936
### Module import
3037

3138
```js
32-
import Alpine from '@alpinejs/csp'
39+
import Alpine from './path/to/module.esm.js'
3340

3441
window.Alpine = Alpine
3542
window.Alpine.start()

0 commit comments

Comments
 (0)