Comments (17)
@criticalmash Thanks for the issue! If you're reporting a bug, please be sure to include:
- The version of
assemble
you are using. - Your assemblefile.js (This can be in a gist)
- The commandline output. (Screenshot or gist is fine)
- What you expected to happen instead.
If your issue is related to one of the following, please open an issue there:
- grunt-assemble Issues with using assemble in grunt or the grunt-assemble library.
- handlebars-helpers Issues with using handlebars helpers from the handlebars-helpers library.
from assemble.
Hello, still haven't been able to figure this out on my own. I have an upcoming project that I'd like build using Assemble. It has a lot of custom content types and I'm afraid that this issue will be a huge block towards using Assemble.
If you need more details, or if this issue belongs under a different repo, please let me know.
Thanks
from assemble.
The code above looks correct. I'll try to take a closer look at the repository within the next few days.
If you have a stacktrace of the error, that could help. If one didn't come out originally, you can use --verbose
and it should show more information.
from assemble.
Thanks for the tip on verbose mode. Here's what I get when I run it...
TypeError: this.emit is not a function
at Object.Cache.get (/Users/john/Sites/assemble/asm-pager-test/node_modules/cache-base/index.js:150:10)
at /Users/john/Sites/assemble/asm-pager-test/node_modules/async-helpers/index.js:333:36
at /Users/john/Sites/assemble/asm-pager-test/node_modules/co/index.js:136:8
at new Promise (<anonymous>)
at thunkToPromise (/Users/john/Sites/assemble/asm-pager-test/node_modules/co/index.js:135:10)
at toPromise (/Users/john/Sites/assemble/asm-pager-test/node_modules/co/index.js:119:55)
at next (/Users/john/Sites/assemble/asm-pager-test/node_modules/co/index.js:99:29)
at onFulfilled (/Users/john/Sites/assemble/asm-pager-test/node_modules/co/index.js:69:7)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
I did some quick console.log
ing inside Cache.get function and it appears that this is being called on a year helper that doesn't have an emit function. Works fine when looping over pages. I'll dig around more and see if I can find anything else.
from assemble.
@criticalmash I noticed a comment in your repository that something is transforming a published
property into a Date object. Are you able to remove or renamed all of the published
properties to see if that makes a difference? There could be something else causing the error than just templates and helpers.
from assemble.
Sure I can remove that. I put it in because I wasn't able to use the helper.
from assemble.
Just pushed an updated assemble file with the middleware commented.
from assemble.
This issue seems to be related somehow to the pagination task. I started commenting out various parts of my newspager
task and learned that if I comment out the pageObj.data
line (line 142 in assemblefile.js) the newsitems
print with the year helper. So I'm thinking that something is happening to the newsitems when they are added to another view.
I'm wondering if making a deep copy of the views at some point of the process would fix the issue. Any ideas?
from assemble.
Good catch... There might be some recursion going on because of the getters and settings being used. The error doesn't lead to that conclusion but it could be that the streams and the async parts of node making it so an object is being mutated in some way and the error happens at a different point and that's just where the stack trace points.
I was trying to track it down to other places too and now I'm trying it to something with the items
list itself from the pagination
.
from assemble.
Been trying the clone route.
Cloning the page object before using it to create a newslist
view allowed me to iterate over the views inside of default.hbs
. So it seemed like I had it fixed.
When I tried to use a helper inside an #each loop within a paginated list of results, I got the same 'this.emit is not a function' error as before. So it looks like something is happening when a renderable view is used as an object inside another renderable view.
from assemble.
@criticalmash I found the bug... it's pretty obscure and I'll get a fix up soon.
TL;DR; it's a mix of things that we've fixed in other places, but overlooked it in some places.
Basically, assemble adds properties to the context used by helpers so helpers can access things as a convenience. Then in the async helper's library, to ensure the same context is used when resolving the helper values, the context is saved internally and used with .apply
when calling the helper function.
The context is added to an internal object using define-property
to make the property hidden when debugging because the context can get pretty large. Most of the time this is fine, but in the case of passing an array of views to the each
helper, the context of the helpers inside the body of the each
ends up being an individual view/item. Since these instances have a get
and set
method on them, define-property
sees that as an access-descriptor
and sets it like a getter instead of a value. So when the .context
was called, it was actually calling a different method than expected.
from assemble.
Alright, thanks. Always amazed when a take a deeper look into assemble and see something new.
BTW: how can I be notified when new releases are out?
from assemble.
The context is added to an internal object using define-property to make the property hidden when debugging because the context can get pretty large
fwiw, this is mostly done to prevent circular references from being merged onto the context
from assemble.
@criticalmash if you clear your node modules and install again, you should get the latest dependencies containing the bugfix. Let me know if it works, then we can close this.
BTW: how can I be notified when new releases are out?
Right now, the best way is to watch the repositories and follow us to see our activity. You can also follow us and assemble on twitter. We'll try to tweet major releases.
from assemble.
Doesn't github show activity when you watch a repository?
from assemble.
That's what I mean by "follow the projects". I edited it to say "watch the repositories".
from assemble.
OK, it took me a couple of tries but I now have [email protected] installed. Working great now.
Thanks for all your help.
from assemble.
Related Issues (20)
- data not available to pages HOT 2
- Is Assemble still active? HOT 2
- Provide a generated API documentation HOT 11
- app.cwd points to original cwd when passing --cwd HOT 4
- partials/layouts collections discard dot namespaces in view keys HOT 36
- Contribution guide link is broken in the project's issue template
- Creating a navigation bar HOT 2
- Accessing variables outside of each block HOT 4
- Trouble accessing custom collection from inside template file HOT 4
- Passing pages.data to yaml front matter. HOT 7
- Nested if statements causing custom parameters in partials to become repeated/global scope HOT 3
- How to add pagination in grunt-assemble HOT 2
- Error with escape function and nested variables HOT 1
- Markdown Helper HOT 2
- Hi Guys. HOT 5
- Produce a .php file HOT 4
- Render php Files? HOT 3
- Project status? HOT 6
- Assemble logo as an SVG? HOT 2
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 assemble.