These are chat archives for jescalan/roots

23rd
Feb 2016
Nathan Walker
@NathanWalker
Feb 23 2016 21:22
Thanks @jenius ... it is strange, not sure why css would be undefined... i am using ejs
Jeff Escalante
@jescalan
Feb 23 2016 21:23
are you using css pipeline
Nathan Walker
@NathanWalker
Feb 23 2016 21:23
"css-pipeline": "^0.3.1",
Jeff Escalante
@jescalan
Feb 23 2016 21:23
are any other locals defined?
Nathan Walker
@NathanWalker
Feb 23 2016 21:24
'include' is defined and working
Jeff Escalante
@jescalan
Feb 23 2016 21:24
thats not a local
under the locals key in app.coffee, add a k/v pair
take out css for now so it renders, and see if the local you added is defined
Nathan Walker
@NathanWalker
Feb 23 2016 21:24
k 1 min
Jeff Escalante
@jescalan
Feb 23 2016 21:24
if not, ejs is not accepting locals from roots, and we'll have to try to put in a fix
Nathan Walker
@NathanWalker
Feb 23 2016 21:26
ok yes 'locals' is working
Jeff Escalante
@jescalan
Feb 23 2016 21:27
ok with the css call
Nathan Walker
@NathanWalker
Feb 23 2016 21:27
now it complains about <%- js() %> ... the other plugin
Jeff Escalante
@jescalan
Feb 23 2016 21:27
you are using <%= css %>?
yeah thats the wrong syntax
you need an = sign
Nathan Walker
@NathanWalker
Feb 23 2016 21:27
<%- css() %>
Jeff Escalante
@jescalan
Feb 23 2016 21:27
wrong syntax
Nathan Walker
@NathanWalker
Feb 23 2016 21:28
<%= css() %> ... same error
css is not defined
Jeff Escalante
@jescalan
Feb 23 2016 21:29
hmm... i feel like something else is going wrong here
is your app.coffee set up correctly?
ejs and locals are working within roots
here's the passing test to show it
Nathan Walker
@NathanWalker
Feb 23 2016 21:30
strange...here's my app.coffee
well not coming through..1 sec

js_pipeline = require 'js-pipeline'
css_pipeline = require 'css-pipeline'
charge_config = require './charge_config.json'
netlify = require 'roots-netlify'

module.exports =

Contents of the views, assets, and infowrap folders will be dumped directly

into the root of the site. The infowrap folder is where we deploy our

frontend code.

dump_dirs: ['views', 'assets', 'infowrap', 'ext']

configure local dev server behavior

server: charge_config

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

extensions: [

# Create Netlify config files for this environment (_redirects)
netlify
  redirects: [
    '/sitemap.xml.gz': 'https://s3.amazonaws.com/infowrap/staging/sitemap.xml.gz'
    '/en/*': '/404.html'
    '/*': '/index.html'
  ]
,

# Build JS assets in correct order
js_pipeline(
  files: [
    'infowrap/scripts/iw/vendors.js',
    'assets/js/bootstrap.min.js',
    'assets/js/respimage.min.js',
    'assets/js/jpreloader.min.js',
    'assets/js/smoothscroll.min.js',
    'assets/js/jquery.nav.js',
    'assets/js/jquery.inview.min.js',
    # 'assets/js/jquery.counterup.min.js',
    'assets/js/jquery.stellar.min.js',
    'assets/js/responsiveslides.min.js',
    'assets/js/script.js',
    'infowrap/scripts/iw/core.js'
  ]
),

css_pipeline(
  files: ['assets/css/*.css'], #'assets/css/colors/blue.css'
  hash: true
)

]

Jeff Escalante
@jescalan
Feb 23 2016 21:31
wrap it in three backticks on both sides
or put it in a gist
Nathan Walker
@NathanWalker
Feb 23 2016 21:32
js_pipeline  = require 'js-pipeline'
css_pipeline = require 'css-pipeline'
charge_config = require './charge_config.json'
netlify = require 'roots-netlify'

module.exports =
  # Contents of the views, assets, and infowrap folders will be dumped directly
  # into the root of the site. The infowrap folder is where we deploy our
  # frontend code.
  dump_dirs: ['views', 'assets', 'infowrap', 'ext']

  # configure local dev server behavior
  server: charge_config

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

  extensions: [
    # Create Netlify config files for this environment (_redirects)
    netlify
      redirects: [
        '/sitemap.xml.gz': 'https://s3.amazonaws.com/infowrap/staging/sitemap.xml.gz'
        '/en/*': '/404.html'
        '/*': '/index.html'
      ]
    ,

    # Build JS assets in correct order
    js_pipeline(
      files: [
        'infowrap/scripts/iw/vendors.js',
        'assets/js/bootstrap.min.js',
        'assets/js/respimage.min.js',
        'assets/js/jpreloader.min.js',
        'assets/js/smoothscroll.min.js',
        'assets/js/jquery.nav.js',
        'assets/js/jquery.inview.min.js',
        # 'assets/js/jquery.counterup.min.js',
        'assets/js/jquery.stellar.min.js',
        'assets/js/responsiveslides.min.js',
        'assets/js/script.js',
        'infowrap/scripts/iw/core.js'
      ]
    ),

    css_pipeline(
      files: ['assets/css/*.css'], #'assets/css/colors/blue.css'
      hash: true
    )
  ]
Jeff Escalante
@jescalan
Feb 23 2016 21:35
ok, can you replicate this in a fresh project?
base template, change .jade to .ejs, replace syntax?
if it still doesn't work, zip that project and drop here and I'll debug it
Nathan Walker
@NathanWalker
Feb 23 2016 21:42
thanks yeah same issue with fresh project so strange...was working fine couple days ago... when the dependencies were updated is when things started to not work... uploading zip for download now
Can download whole project here (kinda big): https://d2wp4shknjcfjl.cloudfront.net/api/file/klhkP1PqR6OuiGy7MdN3
Jeff Escalante
@jescalan
Feb 23 2016 21:43
could you just send the fresh project?
no node_modules
Nathan Walker
@NathanWalker
Feb 23 2016 21:46
sure thing reuploading (still big though, just big project)... 1 min
Jeff Escalante
@jescalan
Feb 23 2016 21:48
how is it big? just a default template?
should be very small
unless you have node_modules in there still
Nathan Walker
@NathanWalker
Feb 23 2016 21:50
ok here is is:
it's our project... wouldn't be a good test unless you have everything i have.. so there it is
i could delete the 'public' folder
Jeff Escalante
@jescalan
Feb 23 2016 21:51
it would still be a good test actually
I'm trying to isolate whether it's something you have or an issue with roots and ejs
did you actually test with a fresh project?
that's what I was asking originally
roots new, change jade out for ejs, see if it works
if that doesn't work, I know where to go for the fix. if it does, I know it's something specific to your project and we can investigate further
Nathan Walker
@NathanWalker
Feb 23 2016 21:54
i added our project into the new setup... lemme try not doing that... 1 min
Jeff Escalante
@jescalan
Feb 23 2016 21:54
:+1:
Nathan Walker
@NathanWalker
Feb 23 2016 22:03
ok it builds and runs... btw, syntax with ejs is <%- css() %>
so something up with our setup or dependencies i guess
Nathan Walker
@NathanWalker
Feb 23 2016 22:15
seems to be an issue with having an .ejs file in a folder
with our setup... we don't have any .ejs files directly under 'views'
instead, we use 'views/en/index.ejs'
no that's not it either... i'm completely stumped
is there a way i can pass css as a local through the app.coffee
locals:
  css: css_pipeline.css
something like that
?
Jeff Escalante
@jescalan
Feb 23 2016 22:20
it's passed in the same way through the extension
Nathan Walker
@NathanWalker
Feb 23 2016 22:20
@jenius this is the fresh project with our setup in there.. minimal...35 megs:
https://d2wp4shknjcfjl.cloudfront.net/api/file/6rXKy6O9TcO7xLcJ3TtQ
if you get a chance, help debugging that would be very helpful... thank you for any time
Jeff Escalante
@jescalan
Feb 23 2016 22:20
so this is an issue of some sort with your project specifically
and what you just pasted was your project, the breaking version?
Nathan Walker
@NathanWalker
Feb 23 2016 22:21
npm install
roots watch
should give you same error after download that zip
Jeff Escalante
@jescalan
Feb 23 2016 22:22
k
will give it a shot
Jeff Escalante
@jescalan
Feb 23 2016 23:08
wow this is a wild project structure
so you are in like 3-4 levels of includes and nesting before we get to any content
i feel like that has something to do with it
Nathan Walker
@NathanWalker
Feb 23 2016 23:25
strange thing is its worked perfectly up until today when the package updated
we like reusability and having things broken up that way helps give us the flexibility we need
Nathan Walker
@NathanWalker
Feb 23 2016 23:38
we're trying to get a release out today and stuck on that... pretty frustrating, just so puzzling
Jeff Escalante
@jescalan
Feb 23 2016 23:39
hey sorry i found the issue @NathanWalker
you are trying to use the local in an ignored partial
the partial has an _ before it, which means it's ignored from the output
this means it will not get locals injected. it is just pulled in through whatever mechanism ejs uses
the file that is including it does have the locals though
if there's a way to pass locals through an include with ejs, that will fix the issue
it does seem like there is a way to pass locals through though, you are passing vertical through each time you include
so you should be able to also pass css, starting from /en/contractor all the way down to partials/_head, which is the final link in the chain generating the error
sorry for the delay, and hope this helps!
basically, if roots processes the file directly, it's able to inject the locals
if not, it's up to whatever the templating language does with the locals in the template
Nathan Walker
@NathanWalker
Feb 23 2016 23:47
ok fantastic, thanks for this, i'll try that