Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Optimize projects
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuan Duc Designer committed Jan 27, 2022
1 parent b888e53 commit 9c0069e
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 17 deletions.
82 changes: 73 additions & 9 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,67 @@ module.exports = {
}
}
},
'gatsby-plugin-offline',
'gatsby-plugin-sitemap',
{
resolve: 'gatsby-plugin-offline',
options: {
workboxConfig: {
runtimeCaching: [{
// Use cacheFirst since these don't need to be revalidated (same RegExp
// and same reason as above)
urlPattern: /(\.js$|\.css$|[^:]static\/)/,
handler: 'CacheFirst',
},
{
// page-data.json files, static query results and app-data.json
// are not content hashed
urlPattern: /^https?:.*\/page-data\/.*\.json/,
handler: 'StaleWhileRevalidate',
},
{
// Add runtime caching of various other page resources
urlPattern: /^https?:.*\.(png|jpg|jpeg|webp|svg|gif|tiff|js|woff|woff2|json|css)$/,
handler: 'StaleWhileRevalidate',
},
{
// Google Fonts CSS (doesn't end in .css so we need to specify it)
urlPattern: /^https?:\/\/fonts\.googleapis\.com\/css/,
handler: 'StaleWhileRevalidate',
},
],
},
},
},
{
resolve: 'gatsby-plugin-sitemap',
options: {
query: `
{
site {
siteMetadata {
siteUrl: url
}
}
allSitePage(
filter: {
path: { regex: "/^(?!/404/|/404.html|/dev-404-page/)/" }
}
) {
edges {
node {
path
}
}
}
}
`,
output: '/sitemap.xml',
serialize: ({ site, allSitePage }) => allSitePage.edges.map((edge) => ({
url: site.siteMetadata.siteUrl + edge.node.path,
changefreq: 'daily',
priority: 0.7
}))
}
},
{
resolve: 'gatsby-plugin-manifest',
options: {
Expand All @@ -162,15 +221,12 @@ module.exports = {
{
resolve: 'gatsby-plugin-sass',
options: {
implementation: require('sass'),
postCssPlugins: [...postCssPlugins],
cssLoaderOptions: {
camelCase: false,
},
// Override the file regex for Sass
sassRuleTest: /\.s(a|c)ss$/,
// Override the file regex for CSS modules
sassRuleModulesTest: /\.module\.s(a|c)ss$/,
},
camelCase: false
}
}
},
`gatsby-plugin-gatsby-cloud`,
{
Expand Down Expand Up @@ -209,5 +265,13 @@ module.exports = {
},
},
`gatsby-plugin-typescript`,
{
resolve: 'gatsby-plugin-webpack-speed-measure',
options: {
disable: true,
},
},
`gatsby-plugin-split-css`,
'gatsby-plugin-scss-typescript',
],
};
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"gatsby-plugin-sass": "^4.2.0",
"gatsby-plugin-sharp": "^3.2.1",
"gatsby-plugin-sitemap": "^4.0.0",
"gatsby-plugin-split-css": "^2.0.2",
"gatsby-plugin-typescript": "^4.6.0",
"gatsby-plugin-typography": "^3.2.0",
"gatsby-remark-autolink-headers": "^4.0.0",
Expand Down Expand Up @@ -99,6 +100,8 @@
"eslint-watch": "7.0.0",
"flow-bin": "0.163.0",
"flow-typed": "3.4.0",
"gatsby-plugin-scss-typescript": "^5.1.0",
"gatsby-plugin-webpack-speed-measure": "^0.1.1",
"identity-obj-proxy": "3.0.0",
"jest": "26.6.3",
"jest-cli": "26.6.3",
Expand Down
56 changes: 48 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2278,6 +2278,17 @@
dependencies:
defer-to-connect "^2.0.0"

"@teamsupercell/typings-for-css-modules-loader@^2.4.0":
version "2.5.1"
resolved "https://registry.yarnpkg.com/@teamsupercell/typings-for-css-modules-loader/-/typings-for-css-modules-loader-2.5.1.tgz#9a8c5f9667de5edbc18a5e5d4c1a5c38a09ca004"
integrity sha512-8Dz/2awNbkrFHf3IpF8YGUPniXAZW/z7OTiosO+xucIU1+jVg/cT4uyGZ7z9cmAsnExsxq4igazxwgGBXVpUgA==
dependencies:
camelcase "^5.3.1"
loader-utils "1.2.3"
schema-utils "^2.0.1"
optionalDependencies:
prettier "*"

"@tokenizer/token@^0.3.0":
version "0.3.0"
resolved "https://registry.yarnpkg.com/@tokenizer/token/-/token-0.3.0.tgz#fe98a93fe789247e998c75e74e9c7c63217aa276"
Expand Down Expand Up @@ -4070,7 +4081,7 @@ chainsaw@~0.1.0:
dependencies:
traverse ">=0.3.0 <0.4"

[email protected], chalk@^2.0.0, chalk@^2.4.1, chalk@^2.4.2:
[email protected], chalk@^2.0.0, chalk@^2.0.1, chalk@^2.4.1, chalk@^2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
Expand Down Expand Up @@ -4671,7 +4682,7 @@ core-js@^2.4.0:
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec"
integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==

core-js@^3.17.2, core-js@^3.2.1:
core-js@^3.0.0, core-js@^3.17.2, core-js@^3.2.1:
version "3.20.3"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.20.3.tgz#c710d0a676e684522f3db4ee84e5e18a9d11d69a"
integrity sha512-vVl8j8ph6tRS3B8qir40H7yw7voy17xL0piAjlbBUsH7WIfzoedL/ZOr1OV9FyZQLWXsayOJyV4tnRyXR85/ag==
Expand Down Expand Up @@ -6938,6 +6949,16 @@ gatsby-plugin-sass@^4.2.0:
resolve-url-loader "^3.1.2"
sass-loader "^10.1.1"

gatsby-plugin-scss-typescript@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/gatsby-plugin-scss-typescript/-/gatsby-plugin-scss-typescript-5.1.0.tgz#645e6c5283a5745fbf592c0a89bc0e2e887a1f06"
integrity sha512-ARnAZ14hRr3bnE4bSW7Gg180i9L1xpHwyq1H9fpF9wscFK4IgxFQmbXtIdMxa1loQANyDQRR52nVH/lzOT7IaA==
dependencies:
"@teamsupercell/typings-for-css-modules-loader" "^2.4.0"
core-js "^3.0.0"
resolve-url-loader "^3.1.2"
sass-loader "^10.1.1"

gatsby-plugin-sharp@^3.2.1:
version "3.14.3"
resolved "https://registry.yarnpkg.com/gatsby-plugin-sharp/-/gatsby-plugin-sharp-3.14.3.tgz#3db33ddfb2b83365ee2314eaaee6d1ceed046032"
Expand Down Expand Up @@ -6972,6 +6993,11 @@ gatsby-plugin-sitemap@^4.0.0:
minimatch "^3.0.4"
sitemap "^7.0.0"

gatsby-plugin-split-css@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/gatsby-plugin-split-css/-/gatsby-plugin-split-css-2.0.2.tgz#64cc353cbfb124e7952a67d0b8dd2a6a87d7f987"
integrity sha512-dgEC+LEkaC1VCE12KG9//KWe1XqwHoKA291j18/6STrkT8xC+O2QhEBrpxRl/3+Nbw5VVKT9iXAVFAU2+It/YQ==

gatsby-plugin-typescript@^3.14.0:
version "3.14.0"
resolved "https://registry.yarnpkg.com/gatsby-plugin-typescript/-/gatsby-plugin-typescript-3.14.0.tgz#5f079f59576f768025cad0d79feaf62c00812a96"
Expand Down Expand Up @@ -7013,6 +7039,13 @@ gatsby-plugin-utils@^1.14.0:
"@babel/runtime" "^7.15.4"
joi "^17.4.2"

gatsby-plugin-webpack-speed-measure@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/gatsby-plugin-webpack-speed-measure/-/gatsby-plugin-webpack-speed-measure-0.1.1.tgz#ca1beb875162fa41cadd6d3069f97679b3ac467f"
integrity sha512-B3+UeChZaUcJTTQcRPlTNs/zT8dZXDxTi0gX6+eke/W43W1MqDtWQomUSspOcYxues1kG638Q6vNUtcBJBxvvg==
dependencies:
speed-measure-webpack-plugin "1.3.1"

gatsby-react-router-scroll@^4.14.0:
version "4.14.0"
resolved "https://registry.yarnpkg.com/gatsby-react-router-scroll/-/gatsby-react-router-scroll-4.14.0.tgz#8825c437f2ce07144dff2013f405b43af8159069"
Expand Down Expand Up @@ -12287,16 +12320,16 @@ prepend-http@^2.0.0:
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897"
integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=

prettier@*, prettier@^2.3.2, prettier@^2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.5.1.tgz#fff75fa9d519c54cf0fce328c1017d94546bc56a"
integrity sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==

prettier@^1.19.1:
version "1.19.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==

prettier@^2.3.2, prettier@^2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.5.1.tgz#fff75fa9d519c54cf0fce328c1017d94546bc56a"
integrity sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==

pretty-bytes@^5.1.0, pretty-bytes@^5.4.1:
version "5.6.0"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb"
Expand Down Expand Up @@ -13318,7 +13351,7 @@ scheduler@^0.20.2:
loose-envify "^1.1.0"
object-assign "^4.1.1"

schema-utils@^2.6.5:
schema-utils@^2.0.1, schema-utils@^2.6.5:
version "2.7.1"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.7.1.tgz#1ca4f32d1b24c590c203b8e7a50bf0ea4cd394d7"
integrity sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==
Expand Down Expand Up @@ -13762,6 +13795,13 @@ specificity@^0.4.1:
resolved "https://registry.yarnpkg.com/specificity/-/specificity-0.4.1.tgz#aab5e645012db08ba182e151165738d00887b019"
integrity sha512-1klA3Gi5PD1Wv9Q0wUoOQN1IWAuPu0D1U03ThXTr0cJ20+/iq2tHSDnK7Kk/0LXJ1ztUB2/1Os0wKmfyNgUQfg==

[email protected]:
version "1.3.1"
resolved "https://registry.yarnpkg.com/speed-measure-webpack-plugin/-/speed-measure-webpack-plugin-1.3.1.tgz#69840a5cdc08b4638697dac7db037f595d7f36a0"
integrity sha512-qVIkJvbtS9j/UeZumbdfz0vg+QfG/zxonAjzefZrqzkr7xOncLVXkeGbTpzd1gjCBM4PmVNkWlkeTVhgskAGSQ==
dependencies:
chalk "^2.0.1"

spin.js@^2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/spin.js/-/spin.js-2.3.2.tgz#6caa56d520673450fd5cfbc6971e6d0772c37a1a"
Expand Down

0 comments on commit 9c0069e

Please sign in to comment.