The utils for static site without javascript
npm install gatsby-plugin-no-javascript-utils
The utils for static site without JavaScript
Support Gatsby v2, v3, v4 and v5
``bash`
npm i gatsby-plugin-no-javascript-utils
#or
yarn add gatsby-plugin-no-javascript-utils
`js
// In your gatsby-config.js
module.exports = {
siteMetadata: {
title: 'Blog',
description: 'Web Blog',
},
polyfill: false,
plugins: [
'gatsby-plugin-react-helmet',
'gatsby-plugin-postcss',
/ ... /
// make sure it is included last in the plugins array.
'gatsby-plugin-no-javascript-utils',
],
}
`
`js`
// In your gatsby-config.js
module.exports = {
plugins: [
{
resolve: 'gatsby-plugin-no-javascript-utils',
options: {
noScript: true,
noSourcemaps: true,
removeGeneratorTag: true,
removeHeadDataAttrs: true,
noInlineStyles: false,
removeGatsbyAnnouncer: false,
},
},
],
}
noScript?: boolean (default: true)
Removes all scripts and preload links for scripts and page-data fetching.
`diff
-
-
⋯
-
-
-
`
noSourcemaps?: boolean (default: true)
Disable generation of JavaScript sourcemaps.
removeGeneratorTag?: boolean (default: true)
Remove generator meta tag
`diff`
-
removeHeadDataAttrs?: boolean (default: true)
Removes data-react-helmet and data-gatsby-head data attributes
`diff`
-
-
+
+
noInlineStyles?: boolean (default: false)
Replacing
+
`
removeGatsbyAnnouncer?: boolean (default: false)
The
is announcing route changes in a single-page application where the pages update without a reload. It may be unnecessary on a static sites when you don't use any JavaScript.More: Accessibility Improvements to Client Side Routing in Gatsby
`diff
⋯
-
``