You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/adding-images-fonts-files.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,11 +53,11 @@ This mechanism provides a number of benefits:
53
53
54
54
However there is an **escape hatch** that you can use to add an asset outside of the module system.
55
55
56
-
If you put a file into the `static` folder, it will **not** be processed by Webpack. Instead it will be copied into the public folder untouched. E.g. if you add a file named `sun.jpg` to the static folder, it'll be copied to `public/sun.jpg`. To reference assets in the `static` folder, you need to use a special variable called `__PATH_PREFIX__`. You will need to make sure you set `pathPrefix` in your gatsby-config.js for this to work (set it to `/` if you don't have a path prefix).
57
-
58
-
In JavaScript code, you can use `__PATH_PREFIX__` for similar purposes:
56
+
If you put a file into the `static` folder, it will **not** be processed by Webpack. Instead it will be copied into the public folder untouched. E.g. if you add a file named `sun.jpg` to the static folder, it'll be copied to `public/sun.jpg`. To reference assets in the `static` folder, you'll need to [import a helper function from `gatsby-link` named `withPrefix`](/packages/gatsby-link/#prefixed-paths-helper). You will need to make sure [you set `pathPrefix` in your gatsby-config.js for this to work](/docs/path-prefix/).
59
57
60
58
```js
59
+
import { withPrefix } from'gatsby-link'
60
+
61
61
render() {
62
62
// Note: this is an escape hatch and should be used sparingly!
63
63
// Normally we recommend using `import` for getting asset URLs
Copy file name to clipboardExpand all lines: packages/gatsby-link/README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,6 +59,8 @@ Gatsby allows you to [automatically prefix links](/docs/path-prefix/) for sites
59
59
60
60
This can create problems during development as pathnames won't be prefixed. To handle both, gatsby-link exports a helper function `withPrefix` that prepends the prefix during production but doesn't in development.
61
61
62
+
This is only for pathnames you're constructing manually. The `<Link>` component handles prefixing automatically.
Copy file name to clipboardExpand all lines: packages/gatsby-plugin-sharp/README.md
+31-3Lines changed: 31 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,8 +143,8 @@ allImageSharp {
143
143
#### duotone
144
144
145
145
Applys a "duotone" effect (see [I][1], [II][2], [III][3]) to the source image if
146
-
given two hex colors `shadow` and `highlight` defining start and end color of
147
-
the duotone gradient, e.g.
146
+
given two hex colors `shadow` and `highlight` defining start and end color of
147
+
the duotone gradient, e.g.
148
148
149
149
```javascript
150
150
responsiveResolution(
@@ -161,9 +161,36 @@ responsiveResolution(
161
161
```
162
162
163
163
the source image colors will be converted to match a gradient color chosen based
164
-
on each pixel's [relative luminance][4].
164
+
on each pixel's [relative luminance][4].
165
165
Logic is borrowed from [react-duotone][5].
166
166
167
+
You can pass a third optional parameter, `opacity`:
168
+
169
+
```javascript
170
+
responsiveResolution(
171
+
width:800,
172
+
duotone: {
173
+
highlight:"#f00e2e",
174
+
shadow:"#192550",
175
+
opacity:50
176
+
}
177
+
) {
178
+
src
179
+
srcSet
180
+
base64
181
+
}
182
+
```
183
+
184
+
If set, a semi-transparent version of duotone'd image will be composited over
185
+
the original image, allowing the original image and its colors to partially
186
+
"shine through". _Heads up_: If the original image contains an alpha
187
+
channel it will be [flattened][15] before creating the composite.
188
+
189
+
This works by adding an alpha channel to the duotone'd image - then we let Sharp
190
+
do its magic via [`overlayWith`](http://sharp.dimens.io/en/stable/api-composite/#overlaywith); quoting the Sharp documentation:
191
+
192
+
> If the overlay image contains an alpha channel then composition with <ahref="https://en.wikipedia.org/wiki/Alpha_compositing">premultiplication</a> will occur.
193
+
167
194
#### tracedSVG
168
195
169
196
Generates a traced SVG of the image (see [the original GitHub issue][9]) and
0 commit comments