Skip to content

How to compile from pug files that uses pug locals? #108

@7iomka

Description

@7iomka
[easygettext] could not read: './dev/pages/base-variables.pug' using acorn as parser
Trace: TypeError: ./dev/pages/base-variables.pug:13
    11| - let langInUrl = false
    12| - let appLinkIconSuffix = ''
  > 13| -
    14|         let languages = Object.keys(isoLanguages).filter(code => {
    15|                 return _.includes(supportedLanguages, code);
    16|         }).map(code => {

Cannot read property 'includes' of undefined
    at eval (eval at wrap (/Users/7iomka/Desktop/Projects/Core_new/core_new/node_modules/pug/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:752:11)

My locals and pug build looks like this

const _ = require('lodash');
const locals = { _, ... }
...

 // Compile the source code of file with compilation option from pug-config
      const compiledFunction = pug.compileFile(source, options);
      // Render a set of data
      const html = compiledFunction({
        ...locals,
        langToRender: lang,
        variablesToRender: locals.includeVariables(lang),
      });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions