You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
? What is the name of your project? example
? Describe your project Example
? What is your github username? craigmdennis
? Would you like to use whitespace-sensitive syntax? No
? Would you like a production config file? No
spike compile
npm i spike-contentful -S
Add configuration from the README using the demo Contentful app
Instead of rendering post pages, Spike outputs a single templates/post.html file, as if it were a normal page.
When trying to use {{ item.title }} required in the README, there is an undefined error for item:
{ ModuleBuildError: Module build failed: TypeError: Cannot read property 'title' of undefined
at eval (eval at module.exports (/Users/craigmdennis/Sites/example.com/node_modules/reshape-code-gen/lib/scoped_eval.js:9:10), <anonymous>:1:156)
at eval (eval at module.exports (/Users/craigmdennis/Sites/example.com/node_modules/reshape-code-gen/lib/scoped_eval.js:9:10), <anonymous>:1:170)
at evalNode (/Users/craigmdennis/Sites/example.com/node_modules/reshape-eval-code/lib/index.js:27:70)
at util.modifyNodes (/Users/craigmdennis/Sites/example.com/node_modules/reshape-eval-code/lib/index.js:21:40)
at when.resolve.then (/Users/craigmdennis/Sites/example.com/node_modules/reshape-plugin-util/lib/index.js:26:29)
at tryCatchReject (/Users/craigmdennis/Sites/example.com/node_modules/when/lib/makePromise.js:845:30)
at runContinuation1 (/Users/craigmdennis/Sites/example.com/node_modules/when/lib/makePromise.js:804:4)
at Fulfilled.when (/Users/craigmdennis/Sites/example.com/node_modules/when/lib/makePromise.js:592:4)
at ContinuationTask.run (/Users/craigmdennis/Sites/example.com/node_modules/when/lib/makePromise.js:702:24)
at Scheduler._drain (/Users/craigmdennis/Sites/example.com/node_modules/when/lib/Scheduler.js:62:19)
at runLoaders (/Users/craigmdennis/Sites/example.com/node_modules/webpack/lib/NormalModule.js:195:19)
at /Users/craigmdennis/Sites/example.com/node_modules/loader-runner/lib/LoaderRunner.js:364:11
at /Users/craigmdennis/Sites/example.com/node_modules/loader-runner/lib/LoaderRunner.js:230:18
at context.callback (/Users/craigmdennis/Sites/example.com/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at tryCatchReject (/Users/craigmdennis/Sites/example.com/node_modules/when/lib/makePromise.js:845:30)
at runContinuation1 (/Users/craigmdennis/Sites/example.com/node_modules/when/lib/makePromise.js:804:4)
at Rejected.when (/Users/craigmdennis/Sites/example.com/node_modules/when/lib/makePromise.js:625:4)
at Pending.run (/Users/craigmdennis/Sites/example.com/node_modules/when/lib/makePromise.js:483:13)
at Scheduler._drain (/Users/craigmdennis/Sites/example.com/node_modules/when/lib/Scheduler.js:62:19)
at Scheduler.drain (/Users/craigmdennis/Sites/example.com/node_modules/when/lib/Scheduler.js:27:9) id: '6647cf5f' }
JSON.stringify(post) also causes a Module build failed: TypeError: Converting circular structure to JSON with the default Contentful 'Blog' app. When simply referencing parts of the JSON it works fine:
<ul>
<eachloop="post of contentful.posts">
<li>{{ post.fields.title }}</li>
</each>
</ul>
so getting data from Contentful is not the issue.
Let me know if I'm doing something obviously wrong. If so, I can submit a PR to update the README to clarify. Otherwise, suggestions?
The text was updated successfully, but these errors were encountered:
Hey I'm really sorry for the late response here, but making the template an ignored file should do the trick here - easiest way would be to prefix it with an underscore.
So I had this problem and then fiddled around with things until I didn't, and I never managed to quite diagnose what exactly was going wrong. But I think it has to do with Spike attempting to render the Contentful template as a static view without the supplemented Contentful object, and therefore failing. What ended up working for me was putting layout.html in templates together with post.html, so my post.html began simply:
<extends src='layout.html'>
while my index.html begins:
<extends src='../templates/layout.html'>
Anyway, don't know if this is too late to be helpful, but just thought I'd add.
Spike version:
2.2.1
Node version:
9.11.1
using NVM (have also tried9.3.0
Demo: https://github.com/craigmdennis/example-spike-contentful
spike new example.com
spike compile
npm i spike-contentful -S
spike compile
Instead of rendering post pages, Spike outputs a single
templates/post.html
file, as if it were a normal page.{{ item.title }}
required in the README, there is anundefined
error foritem
:This is the contents of the
post.html
template:JSON.stringify(post)
also causes aModule build failed: TypeError: Converting circular structure to JSON
with the default Contentful 'Blog' app. When simply referencing parts of the JSON it works fine:so getting data from Contentful is not the issue.
Let me know if I'm doing something obviously wrong. If so, I can submit a PR to update the README to clarify. Otherwise, suggestions?
The text was updated successfully, but these errors were encountered: