# @crds_npm/rollup-plugin-content-blocks

> Load content blocks at build time.

Latest version **2.0.8** (published 2021-05-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @crds_npm/rollup-plugin-content-blocks
pnpm add @crds_npm/rollup-plugin-content-blocks
yarn add @crds_npm/rollup-plugin-content-blocks
bun add @crds_npm/rollup-plugin-content-blocks
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.8 |
| Published | 2021-05-17 |
| First published | 2020-04-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 15 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 (+17 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 14 |
| Author | James Janssen |
| Maintainers | crds_npm_org, d3m, dillon.courts, dan.rye, tcmacdonald, rdonnelly02, candrews_crds |
| Keywords | stencil, content, plugin, rollup, crds |

## Links

- npm: https://www.npmjs.com/package/@crds_npm/rollup-plugin-content-blocks
- Repository: https://github.com/alepop/stencil-env
- Homepage: https://github.com/alepop/stencil-env#readme
- Issues: https://github.com/alepop/stencil-env/issues
- npm.io page: https://npm.io/package/@crds_npm/rollup-plugin-content-blocks

## Dependencies (15)

- [dotenv](https://npm.io/package/dotenv.md) 8.2.0
- [xmldom](https://npm.io/package/xmldom.md) ^0.3.0
- [graphql](https://npm.io/package/graphql.md) ^14.6.0
- [is-html](https://npm.io/package/is-html.md) ^2.0.0
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.0
- [graphql-tag](https://npm.io/package/graphql-tag.md) ^2.10.3
- [apollo-boost](https://npm.io/package/apollo-boost.md) ^0.4.7
- [@types/dotenv](https://npm.io/package/@types/dotenv.md) ^8.2.0
- [apollo-client](https://npm.io/package/apollo-client.md) ^2.6.8
- [@types/graphql](https://npm.io/package/@types/graphql.md) ^14.5.0
- [apollo-link-http](https://npm.io/package/apollo-link-http.md) ^1.5.17
- [@types/node-fetch](https://npm.io/package/@types/node-fetch.md) ^2.5.6
- [@rollup/pluginutils](https://npm.io/package/@rollup/pluginutils.md) ^3.0.9
- [apollo-link-context](https://npm.io/package/apollo-link-context.md) ^1.0.20
- [apollo-cache-inmemory](https://npm.io/package/apollo-cache-inmemory.md) ^1.6.5

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 2.0.8 (latest) — 2021-05-17
- 2.0.7 — 2021-05-17
- 2.0.6 — 2021-05-17
- 2.0.5 — 2021-05-17
- 1.0.5 — 2021-05-03
- 1.0.4 — 2021-05-03
- 1.0.3 — 2020-04-30
- 1.0.2 — 2020-04-30
- 1.0.1 — 2020-04-17
- 1.0.0 — 2020-04-17

## README

# @crdschurch/rollup-plugin-content-blocks

This plugin is for use with Crossroads' content blocks in .tsx applications (stencil, react, etc). 

Here is an example for running the plugin in stenciljs: 

```
  rollupPlugins: {
    before: [
      new ContentBlockReplacer({ category: "profile" }).contentBlocks({
        include: "/src/**/*.tsx",
      }),
    ]
    ...
```

The `category` field is the category the content blocks you wish to fetch at build time. The plugin will then search your `.tsx` files for elements whose tag name matches the content block slug. For example, if I wanted to add the content block with the slug matching "profile-personal-info-header", I would simply add this element to my tsx `<profile-personal-info-header />`. The plugin does the fetch and replacement of the content blocks at build time. It does not auto update with the watching of tsx files -- a new build has to be triggered. This means that use of this plugin should coincide with a webhook that triggers a new build whenever content blocks are modified in the CMS.

---
_Source: https://npm.io/package/@crds_npm/rollup-plugin-content-blocks · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
