Reputation: 12926
I keep getting: .../views/index.jade:20 18| alert(error) 19| }) > 20| server.on('warning',function(warning){ 21| alert(warning) 22| }) 23| var num = -1 Unexpected character # expected ' ', '\n', ',', '!' or '='
This is my jade file:
extends layout
block content
#splash(style='z-index: 3120; position: absolute; left:0; top:0; width:100%; min-height:100%; background-color:#444;')
img(src="/stylesheets/some.png", style='display:block; margin-left: auto; margin-right: auto; margin-top:10%;')
div.row
#welcome
div.row
#joined.small-6.columns
#finished.small-6.columns
script
$(document).ready(function(){
var server = io.connect()
$.fn.exists = function(){return this.length>0}
var userName = "none"
server.on('error',function(error){
alert(error)
})
server.on('warning',function(warning){
alert(warning)
})
var num = -1
server.on('welcome', function(data){
userName = data.name
num = data.num
$("#splash").delay(2000)
.queue(function(n){
$(this).fadeOut(1000, function () {
$(this).remove()
$("#welcome").html("Welcome "+data.name)
$("#welcome").fadeIn(1000)
$("#welcome").delay(2000)
.queue(function(n){
$(this).fadeOut(1000, function () {
$(this).remove()
})
n()
})
})
n()
})
})
server.on('joined', function(name){
num += 1
$("#joined").append("<p>"+name+" joined</p>")
$("#joined p").last().delay(1000)
.queue(function(n){
$(this).fadeOut(1000, function (){
$(this).remove()
})
n()
})
})
server.on('finished', function(name){
num -= 1
$("#finished").append("<p>"+name+" logged out</p>")
$("#finished p").last().delay(1000)
.queue(function(n) {
$(this).fadeOut(1000, function () {
$(this).remove()
})
n()
})
})
})
What am I doing wrong? I cant figure it out. This used to work with an earlier version. That version also allowed to write normal javascript.
Upvotes: 3
Views: 3559
Reputation: 32397
Jade version 0.31.0 deprecated implicit text only support for scripts and styles. To fix this all you need to do is add a . character after the script or style tag.
Often you might want large blocks of text within a tag. A good example is with inline scripts or styles. To do this, just add a . after the tag (with no preceding space)
Write script.
instead of script
Upvotes: 6