Z
Z
zwezew2017-11-08 08:40:24
Node.js
zwezew, 2017-11-08 08:40:24

Is there a way to fix issues with include and pug mixins when working with webpack2?

I found the following problems when working with pug in webpack:
1) the file-loader plugin with its src=require breaks the view mixins
img(src="/img/#{imageName}.jpg")
simply by not recognizing that this is a variable and trying to load it as an image. 2) If you include the file with the code where they are used
in the file with variables
- var droids = ["R2D2", "C3PO", "BB8"];

div
  h1 Famous Droids from Star Wars
  for name in droids
    div.card
      h2= name

this code can't get variables. When both variables and code are in one file, there are no problems.
Can this be corrected in some way?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question