These are chat archives for jescalan/roots

5th
Apr 2017
Hanu
@haniuman_twitter
Apr 05 2017 02:01
Wow... Is Spike more complex than Root... or I am a total noob?
I've hear about Postcss, even about Babel, but never about Reshape.
Love that works with Browsersync!
Jeff Escalante
@jescalan
Apr 05 2017 02:49
it is slightly more so, but not much
reshape is very similar to pug
except its better :wink:
i wrote this library, have not marketed it at all yet
but its quite stable
Elvis Furcic
@elvisfurcic_twitter
Apr 05 2017 13:38
Screen Shot 2017-04-05 at 15.29.22.png
Hi, im having problems when updating roots-contentful from version 0.0.7 to 0.0.9. In the templates were it used to read the entries from contentful, it now gives me an error like you see in the screenshot above. It's hard to debug what is actually the problem here and the contentful.coffee that i use seems the same as described in your readme. Did i forget something to configure or update?
Tom Cooper
@tedgarcooper_twitter
Apr 05 2017 20:00
i have a question about using dynamic content outside of blogs... i want to take advantage of front matter for parameters within the jade pages... but i am having a problem addressing the front matter. If i had a typical blog site with a posts folder for posts, then i could iterate over sites.posts to get access to the content of the files that utilize dynamic content within the posts folder. in my example, i have a views folder that contains individual pages on the site and utilize a standard layout named /views/layout/_base.jade that each of the pages in views extends. But in _base.jade, I can not find a way to address the contents of the front matter. Has anyone done this before?
Jeff Escalante
@jescalan
Apr 05 2017 20:01
you should be able to get posts in your other jade files, iterate through them, and access the front matter
Tom Cooper
@tedgarcooper_twitter
Apr 05 2017 20:03
each page in the views folder is separately addressable via links from my index. so at compilation time of the individual jade files within the views folder that has dynamic content, i can't find how to address the front matter.
Jeff Escalante
@jescalan
Apr 05 2017 20:08
i might not be understanding you correctly
but you can use the posts local in any of your views to access posts and their front matter
Tom Cooper
@tedgarcooper_twitter
Apr 05 2017 20:18
The document you are referencing describes a folder named posts that has jade files containing front matter. then you can iterate over site.posts to access the front matter and possibly content of each. The name of the subelement of site is driven by the name of the folder. in my case the files with dynamic content are in the views folder along with index.jade. In index.jade, i have an link to the other pages within view. Each jade file in views extends my layout of _base.jade (extends layout/_base). as an example, i have another view file named test.jade that extends _base that has front matter. within _base.jade using posts does not give me access to the front matter.
Tom Cooper
@tedgarcooper_twitter
Apr 05 2017 20:47
jeff, here is the output from compile:

compiling... { [TypeError: /Users/tom/sample/views/layouts/_base.jade:14
12| meta(charset='utf8')
13| meta(http-equiv='X-UA-Compatible', content='IE=edge, chrome=1')

14| title= posts.title
15| meta(name='description', content= site.description)
16| meta(name='og:title', content= site.title)
17| meta(name='og:url', content= site.url)

Cannot read property 'title' of undefined] path: '/Users/tom/sample/views/layouts/_base.jade' }

the indentation is a greater-than character at line 14 ;-)\
in that snippet, i changed out "posts." to "site." as a test...
and the sample site is based on an example by Andy Shora
Jeff Escalante
@jescalan
Apr 05 2017 21:22
yeah so its best if you organize them into collection folders
if you want front matter available for your base views, you can just use locals instead
there's really no reason to have front matter in base views
Tom Cooper
@tedgarcooper_twitter
Apr 05 2017 21:23
got it. thanks!