Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jawish/rollup-plugin-twig

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jawish/rollup-plugin-twig

Rollup plugin to import Twig templates as a compiled function.

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

rollup-plugin-twig

Rollup plugin that pre-compiles Twig.js templates.

Installation

NPM:

npm install --save-dev rollup-plugin-twig

Yarn:

yarn add --dev rollup-plugin-twig

Usage

Update rollup.config.js:

import { rollup } from 'rollup';
import strip from 'rollup-plugin-twig';

export default {
  input: 'src/index.js',
  output: [
    {
      format: 'cjs',
      file: 'dist/my-lib.cjs.js'
    }
  ],
  plugins: [
    twig()
  ]
};

Create your Twig template files *.twig. e.g.:

<div>{{ name }}</div>

Import your Twig templates where needed. e.g:

import template from './template.twig'

const data = { name: 'John Doe' }
console.log(template.render(data)) // <div>John Doe</div>

Options

Plugin options you can pass :

  • include Minimatch or array of minimatch with files that should be included by default.

  • exclude Minimatch or array of minimatch with files that should be excluded by default.

  • minify Minify the template using html-minifier. Default: true.

  • minifyOptions Options to configure html-minifier. Default options:

{
  removeComments: true,
  collapseWhitespace: true,
  collapseBooleanAttributes: true,
  decodeEntities: true,
  html5: true,
  keepClosingSlash: true,
  minifyCSS: true,
  minifyJS: true,
  minifyURLs: true,
}

License

MIT License

Keywords

FAQs

Package last updated on 28 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc