diff options
author | Kristóf Marussy <kristof@marussy.com> | 2024-03-17 20:05:25 +0100 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2024-03-17 20:15:58 +0100 |
commit | e68de6a4e2c10459228a1c513ba85ab8c04fe8ac (patch) | |
tree | 61fc8edbfb1049b292a62d2ad8b5b16066ae5bad /src/plugins | |
parent | chore(deps): bump dependencies (diff) | |
download | blog-e68de6a4e2c10459228a1c513ba85ab8c04fe8ac.tar.gz blog-e68de6a4e2c10459228a1c513ba85ab8c04fe8ac.tar.zst blog-e68de6a4e2c10459228a1c513ba85ab8c04fe8ac.zip |
Fix responsive asset path
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/responsiveLoaderPlugin.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/responsiveLoaderPlugin.ts b/src/plugins/responsiveLoaderPlugin.ts index 3dc198e..b4600e5 100644 --- a/src/plugins/responsiveLoaderPlugin.ts +++ b/src/plugins/responsiveLoaderPlugin.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2016, Jeremy Stucki | 2 | * Copyright (c) 2016, Jeremy Stucki |
3 | * Copyright (c) Facebook, Inc. and its affiliates. | ||
3 | * Copyright (c) 2024 Kristóf Marussy <kristof@marussy.com> | 4 | * Copyright (c) 2024 Kristóf Marussy <kristof@marussy.com> |
4 | * | 5 | * |
5 | * SPDX-License-Identifier: MIT AND BSD-3-Clause | 6 | * SPDX-License-Identifier: MIT AND BSD-3-Clause |
@@ -11,7 +12,7 @@ import sharp from 'responsive-loader/sharp'; | |||
11 | export default function responsiveLoaderPlugin(): Plugin { | 12 | export default function responsiveLoaderPlugin(): Plugin { |
12 | return { | 13 | return { |
13 | name: 'marussy-responsive-loader-plugin', | 14 | name: 'marussy-responsive-loader-plugin', |
14 | configureWebpack: () => ({ | 15 | configureWebpack: (_config, isServer) => ({ |
15 | mergeStrategy: { | 16 | mergeStrategy: { |
16 | 'module.rules': 'prepend', | 17 | 'module.rules': 'prepend', |
17 | }, | 18 | }, |
@@ -27,6 +28,10 @@ export default function responsiveLoaderPlugin(): Plugin { | |||
27 | options: { | 28 | options: { |
28 | adapter: sharp, | 29 | adapter: sharp, |
29 | format: 'webp', | 30 | format: 'webp', |
31 | // See | ||
32 | // https://github.com/facebook/docusaurus/blob/c745021b01a8b88d34e1d772278d7171ad8acdf5/packages/docusaurus-plugin-ideal-image/src/index.ts#L62-L66 | ||
33 | emitFile: !isServer, | ||
34 | name: 'assets/images/[name].[hash:hex:7].[width].[ext]', | ||
30 | }, | 35 | }, |
31 | }, | 36 | }, |
32 | ], | 37 | ], |