-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use jsDelivr to vendor the dependencies
This way we need to vendor less extra stuff, and we can use jsDelivr's ESM builds for packages that are not ESM-compatible out of the box, such as scroll-lock.
- Loading branch information
Showing
434 changed files
with
70 additions
and
70,753 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,18 +17,19 @@ | |
<meta name="twitter:description" content="{{ .Description }}"> | ||
<meta name="twitter:url" content="{{ .Permalink }}"> | ||
{{- /* TODO: Favicons */}} | ||
<script src="/vendor/[email protected]/dist/scroll-lock.min.js" defer></script> | ||
<script type="importmap"> | ||
{ | ||
"imports": { | ||
"alpinejs": "/vendor/[email protected]/dist/module.esm.min.js", | ||
"autosize": "/vendor/[email protected]/dist/autosize.esm.js", | ||
"swiper": "/vendor/[email protected]/swiper.min.mjs", | ||
"swiper/modules/pagination": "/vendor/[email protected]/modules/pagination.min.mjs" | ||
"alpinejs": "/vendor/[email protected]", | ||
"autosize": "/vendor/[email protected]", | ||
"scroll-lock": "/vendor/[email protected]", | ||
"swiper": "/vendor/[email protected]", | ||
"swiper/css": "/vendor/[email protected]", | ||
"swiper/css/pagination": "/vendor/[email protected]", | ||
"swiper/modules/pagination": "/vendor/[email protected]", | ||
} | ||
} | ||
</script> | ||
<link rel="stylesheet" href="/vendor/[email protected]/swiper-bundle.min.css"> | ||
{{- with resources.Get "sass/main.scss" }} | ||
{{- $opts := dict "transpiler" "libsass" "targetPath" "css/style.css" }} | ||
{{- with . | toCSS $opts }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,20 @@ | ||
# How to vendor a package | ||
# How to vendor packages | ||
|
||
1. Download the package from npm: | ||
1. Find the package on [jsDelivr](https://www.jsdelivr.com/), e.g. | ||
https://www.jsdelivr.com/package/npm/alpinejs. | ||
2. Download the package as an ESM module. If the module name contains slashes | ||
`/`, replace them with dashes `-`. | ||
|
||
```sh | ||
npm pack swiper | ||
|
||
# Or, optionally, specify the version | ||
npm pack [email protected] | ||
``` | ||
|
||
2. Unpack and remove the `tgz` file: | ||
|
||
```sh | ||
tar xf swiper-11.1.15.tgz | ||
rm swiper-11.1.15.tgz | ||
curl https://cdn.jsdelivr.net/npm/PACKAGE@VERSION[/MODULE1[/MODULE2[/...]]]/+esm > PACKAGE@VERSION[-MODULE1[-MODULE2[-...]]].js | ||
``` | ||
3. Rename the `package` folder to `<package>@<version>` format: | ||
Example: | ||
```sh | ||
mv package [email protected] | ||
curl https://cdn.jsdelivr.net/npm/[email protected]/+esm > [email protected] | ||
curl https://cdn.jsdelivr.net/npm/[email protected]/modules/pagination/+esm > [email protected] | ||
``` | ||
4. Commit the vendored package: | ||
|
||
```sh | ||
git add [email protected] | ||
git commit | ||
``` | ||
3. Open the module with an editor and remove the last line that starts with | ||
`//# sourceMappingURL`. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.