Giter Club home page Giter Club logo

Comments (5)

chrisyip avatar chrisyip commented on June 28, 2024 1

koa-pug is not fully support koa@2 yet, though it can work.

  1. koa@2 uses ctx instead of this for context of one request, please use ctx.render instead: https://github.com/koajs/koa/tree/v2.x#old-signature-middleware-v1x---deprecated .
  2. About .pug extname and string interpolation, can you post your codes? I can't reproduce these issues.

from koa-pug.

uptownhr avatar uptownhr commented on June 28, 2024

I must have been doing something dumb, I'm not able to reproduce the .pug extension error anymore. I just tried again and removed the .pug on render and it is working.

Regarding the interpolation, maybe something changed with the new version of pug than what I was using before. Basically, it still works but with the exception of one scenario.

So I have,
p.text-xs-center $ #{product.price}
and
p(data-test="#{product.name}")

The first scenario works fine but is the second that used to work but is not anymore. Ofcourse, I was able to fix this easily by removing the interpolation as it is not needed in this scenario. However, previously, I was able to use the #{} synthax inside quotes and get access to variables.

from koa-pug.

uptownhr avatar uptownhr commented on June 28, 2024

input(type="hidden", name="id", value=product._id)

I'm also seeing that my mongoose _id is being translated to, "572a5caab192c83000684413" From here, it seems a bit clear that it is currently different from the standard jade library I used before with express. Do you happen to know what the configurations are to change these?

from koa-pug.

uptownhr avatar uptownhr commented on June 28, 2024

so i actually was able to reproduce the .pug error. This occurs when including or extending using a relative path.

for example, include ../partials/flash will result in ENOENT: no such file or directory, open '/app/views/partials/flash'\n at /app/views/admin/layout.pug line 118

but include ../partials/flash.pug will work. Same thing with extends ../layout. You need to add .pug for this to work.

from koa-pug.

chrisyip avatar chrisyip commented on June 28, 2024

It is a bug of Pug, and fixed in alpha7: pugjs/pug@2d79b88 .

There're two solutions:

  • If you're using npm ^3.7, you can run npm i [email protected]
  • Reinstall koa-pug, npm will install latest Pug for you.

from koa-pug.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.