ways:

src / blocks / navigation / navigation.jade

src / pages / index.jade

mixin filter div some text include ../blocks/navigation/navigation 

In the navigation itself we have:

 .navigation .container .navigation-row +filter 

However, this construction falls out with an undefined error. What am I doing wrong?

  • Write the full text of the error. - Alexander Bragin
  • jade_mixins.filter is not a function - sinneren
  • Please add to the question before the code examples, in particular "mixin filter ..." the name of the file with relative path from the root directory. For example, directory1 / directory2 / index.pug. - Alexander Bragin
  • Added by. Solved the problem, in principle, by inserting indent content after include. I did not know that it was possible. But it's still interesting to sort out the current problem - sinneren
  • one
    I guess what the error is ... Do you start the conversion? pug src or pug src/pages ? Or something similar. You probably also have blocks in blocks /, but conversion should be done only for src / pages files. That is, something like pug src/pages , not pug src . - Alexander Bragin

1 answer 1

In your case, the navigation.jade file lacks either a mixin filter declaration or its connection from an external file.

For example, the structure may be as follows.

src / blocks / navigation / navigation.jade

 include ../../mixins/filter .navigation .container .navigation-row +filter 

src / mixins / filter.jade

 mixin filter div some text 

src / pages / index.jade

 include ../blocks/navigation/navigation .other-1 .other-2 Example text. 

Then, when converting the entire src directory to HTML, everything will be converted, including mixins.

To exclude unnecessary directories from conversion: you need to either think about the structure, or explicitly specify what to convert and / or exclude.