aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2024-03-17 20:05:25 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2024-03-17 20:15:58 +0100
commite68de6a4e2c10459228a1c513ba85ab8c04fe8ac (patch)
tree61fc8edbfb1049b292a62d2ad8b5b16066ae5bad
parentchore(deps): bump dependencies (diff)
downloadblog-e68de6a4e2c10459228a1c513ba85ab8c04fe8ac.tar.gz
blog-e68de6a4e2c10459228a1c513ba85ab8c04fe8ac.tar.zst
blog-e68de6a4e2c10459228a1c513ba85ab8c04fe8ac.zip
Fix responsive asset path
-rw-r--r--src/plugins/responsiveLoaderPlugin.ts7
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';
11export default function responsiveLoaderPlugin(): Plugin { 12export 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 ],