These are chat archives for jescalan/roots

8th
Jun 2016
Eleazar Junsan
@eljun
Jun 08 2016 07:07
Hello @jescalan
Jeff Escalante
@jescalan
Jun 08 2016 15:49
Hi @eljun! How's it going?
Perry Kibler
@javaporter
Jun 08 2016 16:45

I'm using dynamic_content and trying to set the title via yml frontmatter, what's the best way to do this? I tried this in the layout: title= post.title + ' | Foo' and then in the page:

---
title: 'Home'
---

extends layout

but I'm getting the error: Cannot read property 'title' of undefined

Anyone know what I'm doing wrong?

similar to the above, also trying to set the body class dynamically based on the path, something like this: body(class = '#{_path}'), but sans the / or .html. I tried the replace method used above, but that was throwing errors as well.

Thanks again if you can help with either hangup.

Jeff Escalante
@jescalan
Jun 08 2016 17:41
use a head block in jade and set it in your single post layout
if you look in your normal layout, you should see that the title is hard coded
if you make it into a block, like you have for content, you are able to set it
anything you nest under a block when it's declared serves as the default value
Máté Hajzsó
@hajzso
Jun 08 2016 19:21
Hey guys, I have a noobie question: if something like accord is not available, how do I use a stylus plugin, the standard way?
I mean, where do I put the code referenced here: http://stylusgrid.com/npm.html
My guess is node_modules/stylus/bin/stylus
Máté Hajzsó
@hajzso
Jun 08 2016 19:27
I know this is not the right place to ask, I have to use harp for a project and I'm having trouble including jeet and axis :/
roots had me spoiled :)
Jeff Escalante
@jescalan
Jun 08 2016 19:27
we got yo back :D
but take your harp questions to that channel idn about that bunch of junk :troll:
Máté Hajzsó
@hajzso
Jun 08 2016 19:28
yeah, I didn't find that a harp channel.... ahahaha
Jeff Escalante
@jescalan
Jun 08 2016 19:28
guess im not surprised
maybe you can convince em to use spike for the next project once its more stable
Máté Hajzsó
@hajzso
Jun 08 2016 19:30
actually i don't even know why are they using harp, i guess for the jade / stylus compile, I don't see any other reason
Jeff Escalante
@jescalan
Jun 08 2016 19:30
roots will run jade/stylus for you
Máté Hajzsó
@hajzso
Jun 08 2016 19:31
yeah, I know :) I love roots, I would use it on every project tbh
harp didn't even have livereload, had to put in browsersync myself...
Perry Kibler
@javaporter
Jun 08 2016 19:38
thanks @jescalan . Is there a more elegant way? The reason I ask is that the titles will all have a common suffix (Home | Foo; About | Foo; etc.). I hate to have to put that on every page. I'm moving from MM, in MM, I just did this: title= current_page.data.title + ' | Site Name' || 'Site Name'; the way that worked is that if there was no frontmatter, it was just be Site Name, if there was, About, for instance, it would be About | Site Name
Máté Hajzsó
@hajzso
Jun 08 2016 19:42
okay I'm gonna convince them to ditch harp
Tom Kraak
@tkraak
Jun 08 2016 19:47

@javaporter … can’t you just put your suffix inlocals?

https://github.com/carrot/roots-www/blob/master/app.coffee

Perry Kibler
@javaporter
Jun 08 2016 19:48
@jescalan ah, yes, perfect, thanks
Máté Hajzsó
@hajzso
Jun 08 2016 19:52
I know it sounds ridiculous but I'm having trouble including jeet in roots.... their site says : include 'jeet' which is actually 'jeet/index' , at least there is no jeet.styl anywhere
but then roots only compiles the index.styl, and leaves out the includes there... what am I missing?
so it's basically an empty index.css instead of having the grid, functions..etc imported
Jeff Escalante
@jescalan
Jun 08 2016 19:53
@javaporter the head block way is actually quite elegant once you implement it
what you have going on there with the js is the best way i know of
@hajzso jeet doesnt import any css
Máté Hajzsó
@hajzso
Jun 08 2016 19:54
I've set my css pipeline to assets/css/*/.styl if that has to do anything with it... still doesn't work
Jeff Escalante
@jescalan
Jun 08 2016 19:54
it just makes functions available for you to use
you have to use the functions in order to have it make its mark
Máté Hajzsó
@hajzso
Jun 08 2016 19:55
oh!
Jeff Escalante
@jescalan
Jun 08 2016 19:55
welcome to the world of not polluting your html with gratuitous classes
hahah
Máté Hajzsó
@hajzso
Jun 08 2016 19:55
so it's no problem if my compiled jeet css is empty? (I haven't written any code)
Jeff Escalante
@jescalan
Jun 08 2016 19:55
not a problem at all
Máté Hajzsó
@hajzso
Jun 08 2016 19:55
it just seemed weird...
Jeff Escalante
@jescalan
Jun 08 2016 19:55
the functions are there if/when you need them
Máté Hajzsó
@hajzso
Jun 08 2016 19:55
wow, that's awesome
Jeff Escalante
@jescalan
Jun 08 2016 19:55
axis is the same way
it's 0 weight
until you use it
Máté Hajzsó
@hajzso
Jun 08 2016 19:55
it makes sense now, thanks! :)
Jeff Escalante
@jescalan
Jun 08 2016 19:56
:+1:
Máté Hajzsó
@hajzso
Jun 08 2016 19:58
so should I set back my css pipeline to assets/css/.styl from assets/css/**/.styl ? or it doesnt matter
Jeff Escalante
@jescalan
Jun 08 2016 19:58
i usually just have it grab one file that everything else is imported into
Máté Hajzsó
@hajzso
Jun 08 2016 19:58
i meant assets/css/*.styl of course
Jeff Escalante
@jescalan
Jun 08 2016 19:58
but it doesnt really matter, both will do the same
the latter will include subfolders as well
Máté Hajzsó
@hajzso
Jun 08 2016 19:59
cool, thanks! :)
Perry Kibler
@javaporter
Jun 08 2016 20:24
what's the best way to handle putting a class on the body? I saw this on the documentation: This is not a change that will affect most people, but there were a few global variables inserted automatically for dealing with edge cases, the most commonly used one probably being path to give you the current page path (useful for auto-adding body classes).
but it doesn't really explain how to do it, just says it changed
Tom Kraak
@tkraak
Jun 08 2016 20:36

@javaporter like @jescalan has done here for the body id?

https://github.com/carrot/roots-www/blob/master/views/layout.jade

Perry Kibler
@javaporter
Jun 08 2016 20:44
thanks @tkraak , that gets me closer. I'm not sure how I missed that, I was just looking at that file. Oh well, I'll chalk it up to a long day. However, I'm getting an error on that:
Potentially unhandled rejection [23] TypeError: /Users/pk/Sites/wfp/views/layout.jade:29
    27| 
    28| 
  > 29|   body(class= _path.match(/(\w+)\.html$/)[1])
    30|     block content
    31| 
    32|     != js()

Cannot read property 'match' of undefined
Tom Kraak
@tkraak
Jun 08 2016 21:26
This message was deleted
Tom Kraak
@tkraak
Jun 08 2016 21:48
@javaporter some jade issue we newbies are missing :)
this works fine in index.jade:
block content
  h3 Welcome to roots!
  h4= (_path.match(/(\w+)\.html$/)[1])
Jeff Escalante
@jescalan
Jun 08 2016 22:20
log out _path and make sure it's showing up...
Tom Kraak
@tkraak
Jun 08 2016 22:44
@jescalan title= _path and body(id= _path) work
but it does not like any property on _path
Tom Kraak
@tkraak
Jun 08 2016 22:56
it all works fine in index.jade, but not in layout.jade … why is that?
Máté Hajzsó
@hajzso
Jun 08 2016 23:49
wow @jescalan jeet is amazing!! I really enjoy it :) thanks for the tip, I hope someone will keep maintaining it
oh and I showed roots to the people I work for, and they really liked it, I can use it instead yaaay