How to use pug-filters - 2 common examples

To help you get started, we’ve selected a few pug-filters examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pugjs / pug / packages / pug / lib / index.js View on Github external
return contents;
    }
  });
  ast = applyPlugins(ast, options, plugins, 'postLoad');
  ast = applyPlugins(ast, options, plugins, 'preFilters');

  var filtersSet = {};
  Object.keys(exports.filters).forEach(function (key) {
    filtersSet[key] = exports.filters[key];
  });
  if (options.filters) {
    Object.keys(options.filters).forEach(function (key) {
      filtersSet[key] = options.filters[key];
    });
  }
  ast = filters.handleFilters(ast, filtersSet, options.filterOptions, options.filterAliases);

  ast = applyPlugins(ast, options, plugins, 'postFilters');
  ast = applyPlugins(ast, options, plugins, 'preLink');
  ast = link(ast);
  ast = applyPlugins(ast, options, plugins, 'postLink');

  // Compile
  ast = applyPlugins(ast, options, plugins, 'preCodeGen');
  var js = generateCode(ast, {
    pretty: options.pretty,
    compileDebug: options.compileDebug,
    doctype: options.doctype,
    inlineRuntimeFunctions: options.inlineRuntimeFunctions,
    globals: options.globals,
    self: options.self,
    includeSources: options.includeSources ? debug_sources : false,
github pugjs / babel-plugin-transform-react-pug / src / parse-pug.js View on Github external
export default function(str) {
  return filters.handleFilters(
    parse(
      stripComments(lex(str), {stripUnbuffered: true, stripBuffered: true}),
    ),
  );
}

pug-filters

Code for processing filters in pug templates

MIT
Latest version published 4 years ago

Package Health Score

80 / 100
Full package analysis

Popular pug-filters functions