Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shoonia/gatsby-plugin-no-javascript-utils

The utils for the static Gatsby site without JavaScript
https://github.com/shoonia/gatsby-plugin-no-javascript-utils

gatsby gatsby-plugin

Last synced: about 1 month ago
JSON representation

The utils for the static Gatsby site without JavaScript

Awesome Lists containing this project

README

        

# gatsby-plugin-no-javascript-utils

[![npm version](https://img.shields.io/npm/v/gatsby-plugin-no-javascript-utils.svg)](https://www.npmjs.com/package/gatsby-plugin-no-javascript-utils)

The utils for static site without JavaScript

Support Gatsby v2, v3, v4 and v5

## Install

```bash
npm i gatsby-plugin-no-javascript-utils
#or
yarn add gatsby-plugin-no-javascript-utils
```

## How to use

```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',
],
}
```

## Options

```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



-
My Blog
```

**`removeHeadDataAttrs?: boolean (default: true)`**

Removes [data-react-helmet](https://github.com/nfl/react-helmet) and [data-gatsby-head](https://www.gatsbyjs.com/docs/reference/built-in-components/gatsby-head/) data attributes

```diff
-
-
+
+
```

**`noInlineStyles?: boolean (default: false)`**

Replacing `` tag with `<link>` tag for reducing the size of HTML files and browser caching of CSS files.

```diff
- <style data-href="/styles.457cfd10c24f55260d5a.css"> ⋯
+
```

**`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](https://www.gatsbyjs.com/blog/2020-02-10-accessible-client-side-routing-improvements/)

```diff



-


```

## License

[MIT](./LICENSE)