These are chat archives for jescalan/roots

15th
Jun 2016
Eleazar Junsan
@eljun
Jun 15 2016 03:45
Hello @jescalan, I'm sorry but i'm not a real programmer, I only do the basic stuffs like configuring what is already there. I believe 'rss feeds' always tag along when we create a blog site.
Dominic Monroe
@SevereOverfl0w
Jun 15 2016 08:38
@jescalan Problem is in the post install script. I'll play some.
Marc Haan
@Hoenoe
Jun 15 2016 09:35
Hey can some one tell me how to get sourcemap working in Roots using node-sass?
Marc Haan
@Hoenoe
Jun 15 2016 09:55
I'm used to using gulp, how does it work in Roots for like installing new modules? Any help would be highly appreciate.
Tom Kraak
@tkraak
Jun 15 2016 10:35
@Hoenoe what specifically is your problem with sass? you got it to compile, but no source maps?
Marc Haan
@Hoenoe
Jun 15 2016 10:36
@tkraak yeah it compiling but yes no sourcemap
Tom Kraak
@tkraak
Jun 15 2016 10:37
and you got a scss: section in app.coffee?
Marc Haan
@Hoenoe
Jun 15 2016 10:39

this is how my app.coffee script looks like ''' # axis = require 'axis'

rupture = require 'rupture'

autoprefixer = require 'autoprefixer-stylus'

js_pipeline = require 'js-pipeline'
css_pipeline = require 'css-pipeline'

module.exports =
ignores: ['readme.md', '/layout.*', '/_', '.gitignore', 'ship.conf']

extensions: [
js_pipeline(files: 'assets/js/.coffee'),
css_pipeline(files: 'assets/css/
.scss')
]

node_sass:

# use: [ autoprefixer()]
sourcemap: true

'coffee-script':
sourcemap: true
'''

Tom Kraak
@tkraak
Jun 15 2016 10:40
scss:
    includePaths: [
      './assets/css/vendor'
      './node_modules/'
    ]
    outputStyle: 'nested'
    sourceMap: true
    sourceMapEmbed: true
Marc Haan
@Hoenoe
Jun 15 2016 10:40

oh '# axis = require 'axis'

rupture = require 'rupture'

autoprefixer = require 'autoprefixer-stylus'

js_pipeline = require 'js-pipeline'
css_pipeline = require 'css-pipeline'

module.exports =
ignores: ['readme.md', '/layout.*', '/_', '.gitignore', 'ship.conf']

extensions: [
js_pipeline(files: 'assets/js/.coffee'),
css_pipeline(files: 'assets/css/
.scss')
]

node_sass:

# use: [ autoprefixer()]
sourcemap: true

'coffee-script':
sourcemap: true
'

Tom Kraak
@tkraak
Jun 15 2016 10:41
see mine above
Marc Haan
@Hoenoe
Jun 15 2016 10:41
oh sorry was trying to mark up my pasted code but whent a bit wrong
Marc Haan
@Hoenoe
Jun 15 2016 10:42
yeah Im going to try it out now
its not working do I need to install any extra npm packages?
Tom Kraak
@tkraak
Jun 15 2016 10:48
you did install node-sass, right?
Marc Haan
@Hoenoe
Jun 15 2016 10:51
@tkraak sorry got it working!
Tom Kraak
@tkraak
Jun 15 2016 10:51
and in app.coffee it’s scss: … not node-sass:
Marc Haan
@Hoenoe
Jun 15 2016 10:51
I just needed to put in the right paths
Tom Kraak
@tkraak
Jun 15 2016 10:52
:+1:
Marc Haan
@Hoenoe
Jun 15 2016 10:52
many thanks!
Tom Kraak
@tkraak
Jun 15 2016 10:52
any time
you also don’t even need css_pipeline, but it’s nice
Edin Abazi
@edinchez
Jun 15 2016 10:58
guys, any idea how to stylize the frontmatter date with momentjs? ive included moment.js but im not sure how to approach it from there
Tom Kraak
@tkraak
Jun 15 2016 11:11
@edinchez what does your front matter look like?
Edin Abazi
@edinchez
Jun 15 2016 11:12
it's pretty basic
---
title: 'Test post two!'
date: 13-06-2016
category: 'UX'
---
date doesn't have to be that exact format, but i wanna use moment's relative time functionality, like "3 days ago"
Tom Kraak
@tkraak
Jun 15 2016 11:18
I’m a js newbie, but do you really need a whole library for that?
I would try to calculate that in the template
moment.js is nice though :)
Edin Abazi
@edinchez
Jun 15 2016 11:21
it is nice, and im fine with using the library
im just not sure how to approach it in the jade template
Tom Kraak
@tkraak
Jun 15 2016 11:25
you required in the library I assume?
and then you’ll probably need a moment entry under locals: in app.coffee … I would think … to expose moment to your templates
gotta walk the dogs, back later
Edin Abazi
@edinchez
Jun 15 2016 11:29
hmm, shouldnt i include the script directly in the html considering nodejs wont have a thing to do with the site once it's published?
Tom Kraak
@tkraak
Jun 15 2016 12:32
but node / roots is compiling your jade templates, no?
Edin Abazi
@edinchez
Jun 15 2016 12:50
yeah but the date differs every day, and it has to be calculated on each instance
but nevermind, i got it working
with some good old jquery $.each and .html()
Tom Kraak
@tkraak
Jun 15 2016 13:13
oh, you are right … that date can’t be compiled :)
Jeff Escalante
@jescalan
Jun 15 2016 13:50
@eljun maybe this would be a good time to start learning! I'm happy to offer support, but I don't have the time to work on features I don't need for other people for free, since this is an open source project :(
@SevereOverfl0w thanks! any further info would be helpful, im sure we can patch it. the after install script is just console.logs about the analytics haha
Edin Abazi
@edinchez
Jun 15 2016 18:47
hey @jescalan, how exactly are the posts ordered when using roots-dynamic-content? when i change the date or its format, they keep rearranging but it doesn't really make sense
Jeff Escalante
@jescalan
Jun 15 2016 18:48
randomly
they are run as quickly as possible
Edin Abazi
@edinchez
Jun 15 2016 18:49
oh. is there any way i can order them by date?
Jeff Escalante
@jescalan
Jun 15 2016 18:49
yup
Edin Abazi
@edinchez
Jun 15 2016 18:49
welp, thanks
Jeff Escalante
@jescalan
Jun 15 2016 18:49
if you are using the same function in multiple places, i'd define in as a local in app.coffee so you dont have to copy/paste
comparing dates is a little tougher than comparing numbers with array.sort, but nothing that "javascript sort by date" into google can't get you to :D
Edin Abazi
@edinchez
Jun 15 2016 18:50
could you give me an example of how i'd be able to do it in app.coffee if you don't mind? i only need to sort the posts in my blog index page
Jeff Escalante
@jescalan
Jun 15 2016 19:47
locals: { sort: function (arr) { sort(arr) } }
then in your jade
for post in sort(posts)
of course you'd need to add more logic to the sort function for dates but you see what i mean