0.1.1 • Published 1 year ago

@christian-beckmann/parcel-transformer-twig v0.1.1

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

parcel-transformer-twig

Parcel v2 transformer plugin for twig (twig.js).

Inspired of Parcel v1 plugin parcel-plugin-twig

Installation

npm i -D christian-beckmann/parcel-transformer-twig

Configuration

.parcelrc Parcel Configuration

{
  "extends": ["@parcel/config-default"],
  "transformers": {
    "*.twig": ["@christian-beckmann/parcel-transformer-twig"]
  }
}

Reference Parcel plugin configuration

Customization

You can add custom options for ejs templating engine using a .twigrc, .twigrc.js file.

For more information on customization options, see twig.js

Watching subfolder *.twig files

To watch included/embedded files, parcel needs to know the folder (because twig.js doesn't inform parcel about the included files).

.twigrc

{
  "watchFolder": "./src"
}

Cons

New created files won't be watched. Reload to watch new twig files.