Skip to content

A nunjucks filter to strip line breaks and white space between tags

License

Notifications You must be signed in to change notification settings

spacecraftinc/nunjucks-spaceless-filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nunjucks-spaceless-filter

Strip line breaks and white space between tags.

Usage

const spaceless = require('nunjucks-spaceless-filter');

// (where env is your existing Nunjucks environement)
env.addFilter('spaceless', spaceless);

{% filter spaceless -%}
  <div class="myDiv">
    <p class="myParagraph">Some text</p>
  </div>
{%- end filter %}

// output:
<div class="myDiv"><p class="myParagraph">Some text</p></div>

Arguments

  • value: Source string

Testing

Tests require Mocha and can be run with npm test. You can specify Mocha options, such as the reporter, by adding a mocha.opts file to the test directory.

Running npm test --coverage will generate code coverage reports with Istanbul. The code coverage reports will be located in the coverage directory, which is excluded from the repository.

About

A nunjucks filter to strip line breaks and white space between tags

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published