2.0.8 • Published 3 years ago

@crds_npm/rollup-plugin-content-blocks v2.0.8

Weekly downloads
5
License
MIT
Repository
github
Last release
3 years ago

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