Comments (5)
koa-pug
is not fully support koa@2
yet, though it can work.
koa@2
usesctx
instead ofthis
for context of one request, please usectx.render
instead: https://github.com/koajs/koa/tree/v2.x#old-signature-middleware-v1x---deprecated .- About
.pug
extname and string interpolation, can you post your codes? I can't reproduce these issues.
from koa-pug.
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.
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.
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.
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 runnpm i [email protected]
- Reinstall
koa-pug
,npm
will install latestPug
for you.
from koa-pug.
Related Issues (16)
- hot to get koa's "this" inside view? HOT 4
- 'pretty: true' not working HOT 3
- Maximum call stack size exceeded HOT 7
- koa-pug HOT 2
- Is there an other way to transform the session and flash ? HOT 3
- Outdated dependencies HOT 3
- Can you write a pug view for egg? HOT 4
- Can Koa-pug render multiple blocks? HOT 3
- TypeScript error on koa import HOT 2
- jade extends basedir functionality not working with absolute paths HOT 1
- Why does `BaseContext.render` have to return `void` ? HOT 1
- Exposing locals to layout HOT 4
- Map is not defined HOT 4
- Please upgrade lodash HOT 2
- If the view provided is a folder, pick index.jade as default HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from koa-pug.