Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Browserify with Riot Custom Tags giving Type Error

I'm trying to use riot custom tags with browserify.

TypeError: Cannot read property 'render' of null while parsing file: /Users/michaelmostachetti/Google_Drive/dev/web/mike_mostachetti_site/app/views/blog.tag
at _html.jade (/Users/michaelmostachetti/Google_Drive/dev/web/mike_mostachetti_site/node_modules/riot/node_modules/riot-compiler/dist/compiler.js:58:26)
at compileTemplate (/Users/michaelmostachetti/Google_Drive/dev/web/mike_mostachetti_site/node_modules/riot/node_modules/riot-compiler/dist/compiler.js:692:10)
at Object.compile (/Users/michaelmostachetti/Google_Drive/dev/web/mike_mostachetti_site/node_modules/riot/node_modules/riot-compiler/dist/compiler.js:717:11)
at Stream.<anonymous> (/Users/michaelmostachetti/Google_Drive/dev/web/mike_mostachetti_site/node_modules/riotify/index.js:16:58)
at _end (/Users/michaelmostachetti/Google_Drive/dev/web/mike_mostachetti_site/node_modules/riotify/node_modules/through/index.js:65:9)
at Stream.stream.end (/Users/michaelmostachetti/Google_Drive/dev/web/mike_mostachetti_site/node_modules/riotify/node_modules/through/index.js:74:5)
at DestroyableTransform.onend (/Users/michaelmostachetti/npm-global/lib/node_modules/browserify/node_modules/readable-stream/lib/_stream_readable.js:545:10)
at DestroyableTransform.g (events.js:260:16)
at emitNone (events.js:72:20)
at DestroyableTransform.emit (events.js:166:7)

Here's my package.json

"browserify": {
    "transform": [
      [
         "riotify",
         {
              "template": "jade"
         }
      ]
    ]
}

Here is my index.js.

var riot        = require('riot'),
    blogView    = require('./views/blog.tag');

riot.mount(blogView);

I'm just confused with the error and what is going wrong. I can compile the jade into html without any issues. Here's the example in the docs. https://github.com/jhthorsen/riotify#usage

like image 825
mjmostachetti Avatar asked Oct 30 '22 12:10

mjmostachetti


1 Answers

It might be because the dependency jade isn't installed. I've just checked the stack trace of that error and it points to this line:

return _req('jade').render(html, extend({

So try adding jade and then running it again.

like image 114
Phil Cooper Avatar answered Nov 08 '22 06:11

Phil Cooper



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!