1.0.5 • Published 2 years ago

nunjucks-encore v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Nunjucks Encore

Build NPM Version NPM Downloads

Nunjucks extension for using Webpack Encore. With this extension, you can include CSS, JavaScript and assets in your Nunjucks templates.

How to install it?

$ npm install nunjucks-encore

How to use it?

import { EncoreExtension } from 'nunjucks-encore';

env.addExtension(
  'encore-extension',
  new EncoreExtension({
    entrypointsFilename: 'path/to/entrypoints.json',
    manifestFilename: 'path/to/manifest.json',
  }),
);

The extension adds the tags encore_entry_link_tags, encore_entry_script_tags and asset to Nunjucks.

Encore entry link tags

You can add CSS files to your template with the encore_entry_link_tags tag. The extension will render the whole <link> tag.

<html>
  <head>
    {% encore_entry_link_tags('entry1', 'entry2') %}
  </head>
  <body></body>
</html>

Encore entry script tags

You can add JS files to your template with the encore_entry_script_tags tag. The extension will render the whole <script> tag.

<html>
<head>
</head>
<body>
  {% encore_entry_script_tags('entry1', 'entry2') %}
</body>
</html>

Assets

You can add asset files to your template with the asset tag:

<img src="{% asset('images/image1.png') %}" />
1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago