These are chat archives for jescalan/roots

17th
Jun 2016
Tom Kraak
@tkraak
Jun 17 2016 01:22

@nathandonaldson … here is an example of what @jescalan is eluding to above:

https://github.com/earlylightmedia/elm/blob/master/app.coffee

Nathan Donaldson
@nathandonaldson
Jun 17 2016 01:38
That's awesome - thanks all!!
Eleazar Junsan
@eljun
Jun 17 2016 07:05

Thanks @jescalan, but I managed to solve the sorting issue using another modules:

Here are my code in case someone might need it. Thanks

sortBy = require 'sort-by'

extensions:[
     records(
          blog:
                file: 'datapath.json'
                hook: (res) ->
                    p = res.posts.items
                    p.sort(sortBy('date')
                    return p
                template: 'view/_blog.jade'
                out: (blog) -> '/blog/#{S.slugify(blog.title)} '
    )
]
Edin Abazi
@edinchez
Jun 17 2016 10:21
@jescalan
{ [SyntaxError: reserved word 'function']
  location: { first_line: 16, first_column: 18, last_column: 25 },
  toString: [Function],
  code: 'jeet            = require \'jeet\'\r\nnib             = require \'nib\'\r\nrupture         = require \'rupture\'\r\njs_pipeline     = require \'js-pipeline\'\r\ncss_pipeline    = require \'css-pipeline\'\r\ndynamic_content = require \'dynamic-content\'\r\n\r\nmodule.exports =\r\n  ignores: [\'readme.md\', \'**/layout.*\', \'**/_*\', \'.gitignore\', \'ship.*conf\', \'_assets\']\r\n\r\n  extensions: [\r\n    js_pipeline(files: [\'assets/js/pace.js\', \'assets/js/barba.js\', \'assets/js/jquery.js\', \'assets/js/prism.js\', \'assets/js/jquery.bez.js\', \'assets/js/jquery.stickem.js\', \'assets/js/calc.js\', \'assets/js/main.js\'], out: \'js/build.js\', minify: true),\r\n    css_pipeline(files: \'assets/css/master.styl\')\r\n    dynamic_content()\r\n  ]\r\n\r\n
locals: { sort: function (arr) { sort(arr) } }\r\n\r\n  stylus:\r\n    use: [jeet(), nib(), rupture()]\r\n    sourcemap: true\r\n\r\n  \'coffee-script\':\r\n    sourcemap: true\r\n\r\n  jade:\r\n    pretty: true\r\n',
  filename: 'C:\\Sites\\edinabazi\\app.coffee' }
Alex
@trautmaa
Jun 17 2016 17:28
Hi everyone! I'm trying to figure out how to publish json data on build - does anyone have experience with this? I'd like to make a call to an API on site build, grab some json, and publish it to mysite.com/json.json. Is this possible? I've been trying to do this using jade templating, but I think jade will always wrap the data with <body> tags
Alex
@trautmaa
Jun 17 2016 18:48
Nevermind - not sure what the issue was, but it's fairly trivial, and I've gotten it straightened out
Kevin Bohinski
@kbohinski
Jun 17 2016 18:49
@jescalan thanks! i got around it by doing this (its really ugly):
  • index.html.ejs.jade
  • _index.html.ejs
  • layout.jade
lol