@crds_npm/rollup-plugin-content-blocks
TypeScript icon, indicating that this package has built-in type declarations

2.0.8 • Public • Published

@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.

Package Sidebar

Install

npm i @crds_npm/rollup-plugin-content-blocks

Weekly Downloads

1

Version

2.0.8

License

MIT

Unpacked Size

10.1 kB

Total Files

7

Last publish

Collaborators

  • crds_npm_org
  • d3m
  • dillon.courts
  • dan.rye
  • tcmacdonald
  • rdonnelly02
  • candrews_crds