Open ramstein74 opened 12 years ago
Hi,
Zappa has not been updated by mauricemach for a long long time, now you should use https://github.com/zappajs/zappajs instead. You just have to replace require('zappa')
by require('zappajs')
and npm install zappajs
instead of npm install zappa
For me, it solved this issue.
ok, working now. Other question, about inline views. How to use inline views from other coffeescript files?
Thanks again
What do you mean by inline views? Do you mean including views from coffeecup files?
yes, including views from coffee files
Thank you
2012/8/30 Adrien Antoine notifications@github.com
What do you mean by inline views? Do you mean including views from coffeecup files?
— Reply to this email directly or view it on GitHubhttps://github.com/mauricemach/zappa/issues/127#issuecomment-8151687.
To include coffeecup view, it's very simple:
@get '/': -> @render 'index'
It will load the index.coffee
file inside the views
sub directory.
i have a vista1.coffee inside views to test this is my vista1.coffee
@view vista1: -> doctype 5 html -> head -> title 'vista inline layout' body -> h1 'vista inline layout' @body
when i call it in my app.coffee with @get '/1': -> @render 'vista1',layout:no,foo :'testing'
i get the error TemplateError: Error rendering C:\testzappa\views/6dc9db10-f45f-4789-a520-d31aa7735eed/vista1.coffee: Object #
I´m lost :)
2012/8/30 Adrien Antoine notifications@github.com
To include coffeecup view, it's very simple: @get '/': -> @render 'index' It will load the index.coffee file inside the views sub directory.
— Reply to this email directly or view it on GitHubhttps://github.com/mauricemach/zappa/issues/127#issuecomment-8153535.
In your vista1.coffee
file, just put this: (without @view vista1: ->
)
doctype 5
html ->
head ->
title 'vista inline layout'
body ->
h1 'vista inline layout'
and display it with @render 'vista1'
If you want to use a layout, create a file views/layout.coffee
containing this:
doctype 5
html ->
head ->
title 'vista inline layout'
body ->
@body
and a view views/index.coffee
containing:
h1 'vista inline layout'
Then render it with @render 'index'
and it should have the same display.
You can find more information here:
Good luck ;-)
Hello again another problem with zappa( i guess) in my external layout file in jade
!!! 5 html head
title Jadeout
body script(src=' https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js') script(src=' http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.1/underscore-min.js ') script(src=' http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.1/backbone-min.js') h1 JadeOut != body
Without the 3 line that import the javascript files it works ok but with those 3 lines i get the error ENOENT, no such file or directory 'C:\testzappa\views\ee500cc8-fe5a-456c-959f-da3dcbb54f63\jadeout.jade'
Is this related to how zappa reads the jade file?
Thank you once more
António 2012/8/30 Adrien Antoine notifications@github.com
In your vista1.coffee file, just put this: (without @view vista1: ->)
doctype 5 html -> head -> title 'vista inline layout' body -> h1 'vista inline layout'
and display it with @render 'vista1'
If you want to use a layout, create a file views/layout.coffee containing this:
doctype 5 html -> head -> title 'vista inline layout' body -> @body
and a view views/index.coffee containing:
h1 'vista inline layout'
Then render it with @render 'index' and it should have the same display.
You can find more information here:
Good luck ;-)
— Reply to this email directly or view it on GitHubhttps://github.com/mauricemach/zappa/issues/127#issuecomment-8154685.
Hello again another problem with zappa( i guess) in my external layout file in jade
!!! 5 html head
title Jadeout
body script(src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js') script(src='http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.1/underscore-min.js') script(src='http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.1/backbone-min.js') h1 JadeOut != body
Without the 3 line that import the javascript files it works ok but with those 3 lines i get the error ENOENT, no such file or directory 'C:\testzappa\views\ee500cc8-fe5a-456c-959f-da3dcbb54f63\jadeout.jade'
Is this related to how zappa reads the jade file?
Thank you once more
never mind i did it another way around.
Next issue
in the sample file chat.coffee i try to use backbone js and in the client section code: i try $ => class Task extends Backbone.Model i can see from my browser console that backbone is loaded but if i try in browser console var task= new Task; i get
Task is not defined...
why is that?
thank you
@ramstein74 coffee script automatically closures your code, so Task
is only defined inside that closure. Try to define it as window.Task
. If you have any more questions the repo has moved here.
Meanwhile (until the compatibility fork is merged), the package zappa could be labelled as incompatible with Node 0.8.x (or whatever) in the package.json
per https://npmjs.org/doc/json.html#engines
You can specify the version of node that your stuff works on:
{ "engines" : { "node" : ">=0.1.27 <0.1.30" } }
@matt-hickford this project is not maintaned anymore, the zappajs fork is maintaned and works with 0.8.
Today i tried to run a simple app to test zappa but after npm install express npm install zappa
i goto windows console with node
a=require('zappa') i get the error Cannot read property 'prototype' of undefined at zappa.js (65:15) zappa.js(702:4)