Jade is a technology which is still very much under active development. After the publication of the book there have been some changes which broke the code included in the book, I will be documenting them in the post.
script and style tags
If you use the script and style markers as shown in the book, you will see the warning “Implicit textOnly for `script` and `style` is deprecated. Use `script.` or `style.` instead.”.
The fix is very easy, and is mentioned in the warning message itself – just end the markers with a dot(.).
Replace script with script., and style with style..
What used to be
script
var greeting = 'Welcome to Jade';
would now become
script.
var greeting = 'Welcome to Jade';
What used to be
style(type='text/css')
#wrapper { padding: 0 }
would now become
style(type='text/css').
#wrapper { padding: 0 }
while loop
The example of while loop shown in the book will cause a memory problem – “FATAL ERROR: JS Allocation failed – process out of memory”.
You will now need to enclose the condition within braces in the while construct and mark i++ with a hyphen.
This:
i= 0
while i < 5
div= i
i++
should now be written this way:
i = 0
while (i < 5)
div= i
- i++