Skip to content

Commit

Permalink
chore: 📝 update README
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDutchCoder committed May 8, 2021
1 parent ac9e67a commit 8ad4794
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,39 @@ The `content` option is the actual content that gets written to the file.
Normally it would be a stringified version of the script tags and their
contents.

The `sort` option can be used to determine the order the scripts get appended.
This defaults to `0` and higher values appear later. Negative avlues are allowed
as well.

```js
...ViteAddScripts([
{
position: 'body', // or 'head'
position: 'head',
sort: 3,
content: '<script>window.foo = {}</script>'
},
{
position: 'head',
sort: -2,
content: '<script>window.bar = {}</script>'
},
{
position: 'body',
content: '<script>window.baz = {}</script>'
}
]),
```

Output:
```html
<!DOCTYPE html>
<html>
<head>
<script>window.bar = {}</script>
<script>window.foo = {}</script>
</head>
<body>
<script>window.baz = {}</script>
</body>
</html>
```

0 comments on commit 8ad4794

Please sign in to comment.