File tree 5 files changed +30
-1
lines changed
packages/docusaurus-plugin-ideal-image/src
website/_dogfooding/_docs tests/tests/images
5 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,12 @@ export default function pluginIdealImage(
54
54
rules : [
55
55
{
56
56
test : / \. (?: p n g | j p e ? g ) $ / i,
57
+ // We don't want to use the image loader for non-React source code
58
+ // ie we don't want to use ideal image loader for CSS files...
59
+ // See https://github.com/facebook/docusaurus/issues/10862
60
+ issuer : {
61
+ and : [ / \. (?: t s x ? | j s x ? | m d x ? ) $ / i] ,
62
+ } ,
57
63
use : [
58
64
require . resolve ( '@docusaurus/lqip-loader' ) ,
59
65
{
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ .dogfood-image-test-css {
9
+ background-image : url ('./img/oss_logo.png' );
10
+ background-size : contain;
11
+ }
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 2
2
image : ./img/oss_logo.png
3
3
---
4
4
5
- # Image tests
5
+ # Image Tests
6
6
7
7
import Image from ' @theme/IdealImage' ;
8
8
@@ -14,6 +14,8 @@ export const docusaurusRequire = require('@site/static/img/docusaurus.png');
14
14
15
15
## Regular images
16
16
17
+ Those only render in DEV when IdealImage plugin is disabled.
18
+
17
19
<img src = { docusaurusImport } />
18
20
19
21
<img src = { docusaurusRequire .default } />
@@ -23,3 +25,13 @@ export const docusaurusRequire = require('@site/static/img/docusaurus.png');
23
25
<Image img = { docusaurusImport } />
24
26
25
27
<Image img = { docusaurusRequire } />
28
+
29
+ ## CSS Image
30
+
31
+ import ' ./img-tests.css' ;
32
+
33
+ This should display a div with have a background image
34
+
35
+ <div
36
+ className = " dogfood-image-test-css"
37
+ style = { {border: ' solid' , height: ' 10rem' }} ></div >
You can’t perform that action at this time.
0 commit comments