Skip to content

Commit c979939

Browse files
improve performance
1 parent c21e555 commit c979939

File tree

10 files changed

+37304
-102
lines changed

10 files changed

+37304
-102
lines changed

gatsby-config.js

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ module.exports = {
1919
accessToken: process.env.SHOPIFY_ACCESS_TOKEN,
2020
},
2121
},
22+
{
23+
resolve: 'gatsby-plugin-purgecss',
24+
options: {
25+
develop: true,
26+
purgeOnly: ['/all.sass'],
27+
},
28+
},
2229
{
2330
resolve: "gatsby-source-shopify",
2431
options: {

package-lock.json

+20,853
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"axios": "^0.19.2",
1414
"bulma": "^0.7.5",
1515
"dotenv": "^8.2.0",
16-
"gatsby": "^2.19.17",
17-
"gatsby-cli": "^2.12.59",
16+
"gatsby": "^2.24.11",
17+
"gatsby-cli": "^2.12.66",
1818
"gatsby-image": "^2.2.41",
1919
"gatsby-plugin-apollo": "^3.0.1",
2020
"gatsby-plugin-apollo-shopify": "^1.0.2",
@@ -23,6 +23,7 @@
2323
"gatsby-plugin-manifest": "^2.2.41",
2424
"gatsby-plugin-modal-routing": "^1.1.0",
2525
"gatsby-plugin-offline": "^2.2.10",
26+
"gatsby-plugin-purgecss": "^5.0.0",
2627
"gatsby-plugin-react-helmet": "^3.1.22",
2728
"gatsby-plugin-sass": "^2.1.28",
2829
"gatsby-plugin-sharp": "^2.4.5",
@@ -49,6 +50,7 @@
4950
"styled-components": "^4.4.1"
5051
},
5152
"devDependencies": {
53+
"gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.10",
5254
"prettier": "^1.19.1"
5355
},
5456
"keywords": [

src/components/ProductList/productBox.js

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ const ProductBox = props => {
99
<Img
1010
fluid={product.node.images[0].localFile.childImageSharp.fluid}
1111
key={product.node.images[0].localFile.id}
12+
fadeIn={false}
13+
loading="eager"
1214
alt={product.node.title}
1315
/>
1416
<p className="has-text-weight-semibold has-text-black">{product.node.title}</p>

src/components/ProductPage/Gallery.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ const Gallery = ({ product }) => {
4444
<Img
4545
fluid={x.localFile.childImageSharp.fluid}
4646
alt={product.title}
47-
loading="auto"
47+
fadeIn={false}
48+
loading="eager"
4849
imgStyle={{ WebkitFilter: "blur(1px)", marginBorder: "10px solid black" }}
4950
/>
5051
</ThumbnailBox>
@@ -59,7 +60,8 @@ const Gallery = ({ product }) => {
5960
>
6061
<Img
6162
fluid={x.localFile.childImageSharp.fluid}
62-
loading="auto"
63+
fadeIn={false}
64+
loading="eager"
6365
durationFadeIn={500 * i}
6466
alt={product.title}
6567

@@ -83,6 +85,8 @@ const Gallery = ({ product }) => {
8385
fluid={currentImage.localFile.childImageSharp.fluid}
8486
key={currentImage.localFile.id}
8587
alt={product.title}
88+
fadeIn={false}
89+
loading="eager"
8690
className="imgProduct"
8791
/>
8892
</Box>

src/pages/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const query = graphql`
3737
localFile {
3838
childImageSharp {
3939
fluid(maxWidth: 910) {
40-
...GatsbyImageSharpFluid_noBase64
40+
...GatsbyImageSharpFluid_withWebp_noBase64
4141
}
4242
}
4343
}

src/pages/search.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const query = graphql`
7575
localFile {
7676
childImageSharp {
7777
fluid(maxWidth: 910) {
78-
...GatsbyImageSharpFluid_noBase64
78+
...GatsbyImageSharpFluid_withWebp_noBase64
7979
}
8080
}
8181
}

src/templates/productPage.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export const query = graphql`
149149
localFile {
150150
childImageSharp {
151151
fluid(maxWidth: 910) {
152-
...GatsbyImageSharpFluid_noBase64
152+
...GatsbyImageSharpFluid_withWebp_noBase64
153153
}
154154
}
155155
}

0 commit comments

Comments
 (0)