These are chat archives for jescalan/roots

28th
Jul 2016
Edin Abazi
@edinchez
Jul 28 2016 12:56
how come im not able to ignore a folder from compiling into /public?
module.exports =
  ignores: ['readme.md', '**/layout.*', '**/_*', '.gitignore', 'ship.*conf', '_assets', './_assets']
the folder is named _assets
i tried both methods, it's not working
Tom Kraak
@tkraak
Jul 28 2016 13:12
@edinchez have you named the folder somethings else just to see?
I'm thinking forms of assets might be reserved
Edin Abazi
@edinchez
Jul 28 2016 13:30
@tkraak ive tried, hasnt worked
David Eglin
@djeglin
Jul 28 2016 13:41
try adding _assets/**/* and _assets/* to your ignores
@edinchez
it seems to not do well ignoring folders... but better if you tell it to ignore all the files within that folder
Tom Kraak
@tkraak
Jul 28 2016 13:42
hmm, so '**/_*' is not enough
David Eglin
@djeglin
Jul 28 2016 13:46
_* targets files starting with underscore, not folders. You might be able to do something like _**/*, maybe, but I've never tried it
Tom Kraak
@tkraak
Jul 28 2016 13:52
thanks @djeglin … could you spell out what '**/_*' actually means then?
Edin Abazi
@edinchez
Jul 28 2016 13:53

try adding _assets/**/* and _assets/* to your ignores

this worked @djeglin thank you so much

David Eglin
@djeglin
Jul 28 2016 13:54
@tkraak **/_* targets any file starting with a filename starting with an underscore in any folder - ** = any folder, _* = any filename beginning with an underscore
Tom Kraak
@tkraak
Jul 28 2016 13:56
thanks so much … so none of this has anything to do with where in the directory tree I am
David Eglin
@djeglin
Jul 28 2016 13:57
not that I am aware of. It all starts from your project's root folder
so you could, for example, ignore any items in folders named private that could be nested in any other folder: **/private/*
Tom Kraak
@tkraak
Jul 28 2016 14:00
so that would also ignore /private/secret/? or it would have to be **/private/**/*?
David Eglin
@djeglin
Jul 28 2016 14:02
I don't know off the top of my head... Would have to experiment with that one
(I've never had a use case for delving that deep)
David Eglin
@djeglin
Jul 28 2016 14:06
so it turns out **/private/** is enough for that case
Tom Kraak
@tkraak
Jul 28 2016 14:06
oh, I see now
Jeff Escalante
@jescalan
Jul 28 2016 14:07
you guys got it, the matchers are for files not folders
Edin Abazi
@edinchez
Jul 28 2016 14:07
would be cool if it was for folders too
David Eglin
@djeglin
Jul 28 2016 14:08
so, @edinchez , I would use **/_assets/** for your use case
and for the ultimate catchall, **/_**/** will target anything in any folder beginning with an underscore
Jeff Escalante
@jescalan
Jul 28 2016 14:16
yes
Edin Abazi
@edinchez
Jul 28 2016 14:40
alright @djeglin thanks a lot!
now, does anyone know how to order blog posts by date?
David Eglin
@djeglin
Jul 28 2016 14:43
There are a few ways to do it, but this is the specific way I have mine set up:
- var posts = site.on.all()
- var filteredPosts = _.filter(posts, function(post) { return !post.isCategory && !post._render })    
- var sortedPosts = _.sortBy(filteredPosts, function(post) { return moment(post.date, "DD/MM/YYYY").valueOf() * -1 })
each post in sortedPosts
Edin Abazi
@edinchez
Jul 28 2016 14:44
shall i include moment.js too then?
David Eglin
@djeglin
Jul 28 2016 14:44
Oops. indenting wasn't supposed to go all wonky there
Edin Abazi
@edinchez
Jul 28 2016 14:44
yeah indenting kinda confused me
David Eglin
@djeglin
Jul 28 2016 14:44
fixed it :)
Jeff Escalante
@jescalan
Jul 28 2016 14:46
if you want a simple date-based sort, you can do this with the date object and array.sort
David Eglin
@djeglin
Jul 28 2016 14:46
The filteredPosts line in there is pretty specific to the way I'm using Roots - certain things I don't want to show in indexes and all that, but the principle is sound
Edin Abazi
@edinchez
Jul 28 2016 14:46
@jescalan could you give an example?
Jeff Escalante
@jescalan
Jul 28 2016 14:47
i can, but let me put it out as a js challenge to the room ;)
these are the only tools you need
David Eglin
@djeglin
Jul 28 2016 14:49
...or you could do that. I just used Moment seeing as I'm using it elsewhere for formatting anyway
Edin Abazi
@edinchez
Jul 28 2016 15:05
i'll look into it, thanks! one more question, has anyone tried to implement Disqus before? if so, what did you use as the "unique page identifier?"
David Eglin
@djeglin
Jul 28 2016 15:06
I think I'm just using the url to be honest.
but would be happy to be told of a better way
Tom Kraak
@tkraak
Jul 28 2016 15:09
side question … what extension are you guys using for the blog … roots-collections?
Edin Abazi
@edinchez
Jul 28 2016 15:09
dynamic-content
David Eglin
@djeglin
Jul 28 2016 15:09
same
Edin Abazi
@edinchez
Jul 28 2016 15:10
oh, roots-collections seems to have sorting implemented
Tom Kraak
@tkraak
Jul 28 2016 15:11
thx
Jeff Escalante
@jescalan
Jul 28 2016 16:46
haha sorting is a super basic js function, i honestly didnt think to include it