Skip to content

ark120202/pug-plugin-replace-tags

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pug-plugin-replace-tags

Pug plugin used provide cleaner and pug-compatible syntax for <include> tag in Panorama layout files.

Install

npm i pug-plugin-replace-tags
# or
yarn add pug-plugin-replace-tags

Usage

const pug = require('pug');
const pugPluginReplaceTags = require('pug-plugin-replace-tags');

const source = `
html
  div
    #id
    h2 Header
`;

pug.render(source, {
  plugins: [
    pugPluginReplaceTags({
      div: 'span',
      h2: 'h4'
    })
  ]
});
// <html>
//   <span>
//     <span id="id"></span>
//     <h4>Header</h4>
//   </span>
// </html>

Options

This plugin takes only one option, which can be:

  • Function, that will be called for each node and should return new tag name for this node.
  • Map, where key is old tag and value is either string with new tag or function, which takes node and returns new tag

About

Pug plugin used to replace tag names.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published