Giter Site home page Giter Site logo

Comments (10)

jonschlinkert avatar jonschlinkert commented on May 24, 2024

Hey @dtothefp, taking a look now. In the meantime a couple things one thing stands out

does not seem to persist into my Nunjucks template context

Did you know that this is loading those files from the file system and re-merging them for every middleware call?

from templates.

jonschlinkert avatar jonschlinkert commented on May 24, 2024

@dtothefp is there something special I need to do to get this to run? I get:

npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.2.0
npm ERR! npm  v3.8.9
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node ./index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node ./index.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the assemble-view-issue package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./index.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs assemble-view-issue
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls assemble-view-issue
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/jonschlinkert/dev/assemble/_debugging/assemble-view-issue/npm-debug.log

from templates.

jonschlinkert avatar jonschlinkert commented on May 24, 2024

It looks like the data is on ctx['global-data'] not ctx.globalData, but you're not camelcasing the file name. Not sure about page-data yet

from templates.

jonschlinkert avatar jonschlinkert commented on May 24, 2024

I was able to run it btw. I'm still looking at the code, but I'm thinking the issue has something to do with your setup in tags/debug.js.

If you comment out this code then inspect file.data in a post-render middleware:

app.postRender(/./, (file, next) => {
  console.log(file.data);
  next();
});

the data is there on file.data.

from templates.

dtothefp avatar dtothefp commented on May 24, 2024

Hey that's weird that the data is there in postRender but is not in my template context. Not sure what is going on but this is a significant divergence from when I last updated from 0.17.1

assemble-core@latest

screen shot 2016-07-11 at 9 40 22 am

[email protected]

screen shot 2016-07-11 at 9 43 38 am

You can see in the above screenshots in iron-node that in latest none of the data added in the middleware is present on context.ctx but in 0.17.1 it is. Therefore, I cannot access that data in my templates so the fact that is there in postRender doesn't really help me

from templates.

jonschlinkert avatar jonschlinkert commented on May 24, 2024

Not sure what is going on but this is a significant divergence

Nunjucks must do something different than other engines we've tested. @doowb and I played around with your code and got everything working just by changing your config, but we also have some ideas for something we can do in templates to make it more flexible so you don't need to think about it too much.

I'll talk to @doowb, we might be able to do this now

from templates.

dtothefp avatar dtothefp commented on May 24, 2024

@jonschlinkert I just confirmed that the breaking change was introduced into [email protected]. I'm working on finding the exact commit.

What config change did you make to get it working....was it to the initial nunjucks config?

We have a huge project launching end of this week and would like to upgrade before then otherwise it might be hard and we could end up locked on an old version

from templates.

dtothefp avatar dtothefp commented on May 24, 2024

@jonschlinkert looks like this is the commit that did it. Not sure how it made it's way into [email protected] unless you did a npm publish I'm not seeing

305c700

from templates.

dtothefp avatar dtothefp commented on May 24, 2024

sorry, I lied it's actually this commit e54e448 which makes way more sense cause it was in the 0.20.0 release

from templates.

jonschlinkert avatar jonschlinkert commented on May 24, 2024

Working on something. Give me a few mine. In the meantime, here is a screen I just took using engine-base instead of nunjucks, just to show that this works usually:

example

from templates.

Related Issues (20)

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.