nunjucks-loader

Webpack loader for Nunjucks templates

MIT License

Downloads
8.1K
Stars
28
Committers
3

Bot releases are hidden (Show)

nunjucks-loader - v3.2.0 Latest Release

Published by ogonkov about 3 years ago

  • Assets now could be just a variable (#87, #117).
  • Distributed code now use polyfills
nunjucks-loader -

Published by ogonkov almost 4 years ago

  • New dev option (#101);
  • Maintenance changes (#96). This should reduce loader output in case of duplicated imports of templates.
nunjucks-loader -

Published by ogonkov almost 4 years ago

No code change. webpack version clarified in peerDependencies (#97). Some obsolete files striped from package.

nunjucks-loader - Webpack 5 support

Published by ogonkov almost 4 years ago

  • Webpack 5 support (#95)
  • Files lint (#91)
nunjucks-loader -

Published by ogonkov about 4 years ago

Problem with dynamic assets fixed (#90). Now it should work correctly with imports where trailing slashes used in "static" part, like:

{% static 'foo/' + bar %}
nunjucks-loader -

Published by ogonkov over 4 years ago

Technical release, no code change. Add note to readme about problems with using ES modules for filters and extensions.

nunjucks-loader -

Published by ogonkov over 4 years ago

New static tag has a bug, that is prevent it from exporting asset module to variable, it is fixed (#77)

{% static 'asset.png' as asset_var %}

{{ asset_var }}
nunjucks-loader - v2: more async

Published by ogonkov over 4 years ago

  • BREAKING CHANGE: global function static replaced with static tag (#74). This happens because globals is not supporting async operations, while dynamic assets is using promises, when loaded with import() syntax. To upgrade to this version you need to replace all global static invocation with new static tag.

    - {{ static('image.png') }}
    + {% static 'image.png' %}
    
    - {% set foo = static('bar.jpg') %}
    + {% static 'bar.jpg' as foo %}
    
  • BREAKING CHANGE: handling of async templates is now even better (#67). When loader found async tags or extensions it calls template render via callback, and wrap it to Promise. It was only available for asynchronous filters before, and in some cases could prevent templates from proper rendering, now it should cover all cases, when asynchronous render required.

  • New option esModule added (#65). It will change output to ES module syntax.

  • Minor changes to readme (#63), defaults handling (#72), refactoring (#73)

nunjucks-loader -

Published by ogonkov over 4 years ago

Spec files stripped from package (#75, #76)

nunjucks-loader -

Published by ogonkov over 4 years ago

Your custom tags and filters now correctly imported, when ES modules syntax is used (#68, #70).

nunjucks-loader -

Published by ogonkov over 4 years ago

Technical release, with fresh loader-utils (#58) and loaderUtils.stringifyRequest (#55, #56) instead of JSON.stringify (this one should improve experience for Windows users)

nunjucks-loader -

Published by ogonkov over 4 years ago

Fix minor regression for non-Windows environments with non-existed templates (#52).

nunjucks-loader -

Published by ogonkov over 4 years ago

  • Fix Windows paths handling (#42)
    All files paths now normalized to *nix forward slashes, like Nunjucks do it. Paths with variables is not supported yet.
  • Infrastructure changes
nunjucks-loader - 1.0 🥇

Published by ogonkov almost 5 years ago

First major version!

  • Assets could be loaded with expressions:

    {% set user_id = '100500' %}
    
    <img alt="" src="{{ static('avatars/' + user_id + '.png') }}" />
    
  • Package now contains optional glob dependency. It's required for for dynamic assets described above. If you don't use loading of assets with expression, then you could add --no-optional flag when install package.

nunjucks-loader -

Published by ogonkov almost 5 years ago

  • Assets support added (#28)
    Now you can use builtin static() function, that will resolve given string through webpack loaders

    <img src="{{ static('app_example_a/image.png') }}" />
    

    See README for more examples.

  • GitHub page added (not useful for that moment).

nunjucks-loader - 1.0.0-alpha.9

Published by ogonkov almost 5 years ago

API is now should be stable enough, so next version should be beta with assets loading support.

  • (finally) filters support added 🎊 (#25)
    Imported template function returns a string by default:

    /**
     * @type {function(Object): string}
     */
    import template from 'template.njk';
    

    with asynchronous filters it now returns Promise (i haven't test it for compatibility with html-webpack-loader):

    /**
     * @type {function(Object):Promise.<string, Error>}
     */
    import asyncTemplate from 'async-template.njk';
    
  • Custom extensions imports was not checked for duplicates (#26)

  • Loader now compatible with exports-loader (#21)

nunjucks-loader - 1.0.0-alpha.8

Published by ogonkov almost 5 years ago

  • Major bug fix of render. Before that release the rendering of extensions and globals in parent templates was broken. Now it should work;
  • Readme was slightly updated with templates examples;
  • Minor improvements and refactoring.
nunjucks-loader - 1.0.0-alpha.7

Published by ogonkov about 5 years ago

  • Add nunjucks.installJinjaCompat invocation from options
  • Add badges to readme
nunjucks-loader - 1.0.0-alpha.6

Published by ogonkov about 5 years ago

nunjucks-loader - 1.0.0-alpha.5

Published by ogonkov about 5 years ago

  • Utilize nunjucks.parser to find all dependencies
  • Remove relative paths support (for now), to make code cleaner