mquandalle / meteor-jade Goto Github PK
View Code? Open in Web Editor NEWThe Jade template engine for Meteor/Blaze
Home Page: http://atmospherejs.com/mquandalle/jade
License: MIT License
The Jade template engine for Meteor/Blaze
Home Page: http://atmospherejs.com/mquandalle/jade
License: MIT License
Hey I am sorry if I might me doing this wrong but I have been trying to get dynamic helper to work.
What I am doing is have a helper named attrs return an object {type: 'text', placeholder: 'hello'}
to the template that has input($dyn = attrs)
If this is not the way to use dynamic template, please point me to the right way.
i've come across this error on a couple of places, and now just in trying to include the accounts-ui in a page.
in this case the error is caused by
+loginButtons(align='right')
While building the application:
<runJavaScript-5>:130:11: Expected space
...Buttons align='right')}}
^ (compiling client/layouts/layout.jade)
at [object Object].Scanner.fatal (<runJavaScript-5>:130:11)
at error (<runJavaScript-19>:569:13)
at expected (<runJavaScript-19>:573:5)
at Function.TemplateTag.parse (<runJavaScript-19>:631:9)
at [object Object]._.extend.visitMixin (<runJavaScript-20>:257:37)
at [object Object]._.extend.visitNode (<runJavaScript-20>:236:39)
at [object Object]._.extend.visitBlock (<runJavaScript-20>:220:24)
at [object Object]._.extend.visitNode (<runJavaScript-20>:230:51)
at [object Object]._.extend.visitBlock (<runJavaScript-20>:220:24)
at [object Object]._.extend.visitNode (<runJavaScript-20>:230:51)
at [object Object]._.extend.visitBlock (<runJavaScript-20>:220:24)
at [object Object]._.extend.visitNode (<runJavaScript-20>:230:51)
at [object Object]._.extend.visitBlock (<runJavaScript-20>:220:24)
at [object Object]._.extend.visitNode (<runJavaScript-20>:230:51)
at [object Object]._.extend.visitBlock (<runJavaScript-20>:220:24)
at [object Object]._.extend.visitNode (<runJavaScript-20>:230:51)
at [object Object]._.extend.visitBlock (<runJavaScript-20>:220:24)
at [object Object]._.extend.compile (<runJavaScript-20>:168:10)
at sourceHandler (<runJavaScript-20>:478:46)
also came across the issue here where RAIX points the issue to being a jade problem.
gadicc/meteor-famous-views#6
After upgrading to Meteor 0.8.3 I get the following error
While building package `jade`:
packages/compileJade/plugin/compiler.js:155: Spacebars is not defined (compiling tests/match.jade)
at _.extend.parseText (packages/compileJade/plugin/compiler.js:155)
at packages/compileJade/plugin/compiler.js:212
at Array.forEach (native)
at Function._.each._.forEach (packages/underscore/underscore.js:105)
at _.extend.visitAttributes (packages/compileJade/plugin/compiler.js:205)
at _.extend.visitNode (packages/compileJade/plugin/compiler.js:81)
at _.extend.visitBlock (packages/compileJade/plugin/compiler.js:73)
at _.extend.compile (packages/compileJade/plugin/compiler.js:21)
at sourceHandler (packages/compileJade/plugin/handler.js:11)
Turning off mustache syntax parsing would make it possible to write AngularJS templates without changing Angular's expression delimiters.
In the context of the object { a: 1, b: 2 }
, div #{a}, #{b}
renders as <div>1, #{b}</div>
Please let me know if you need any more info or clarification.
Here's the CLI's output:
While building package `jade`:
packages/compileJade/plugin/compiler.js:155: Spacebars is not defined (compiling tests/match.jade)
at _.extend.parseText (packages/compileJade/plugin/compiler.js:155)
at packages/compileJade/plugin/compiler.js:212
at Array.forEach (native)
at Function._.each._.forEach (packages/underscore/underscore.js:105)
at _.extend.visitAttributes (packages/compileJade/plugin/compiler.js:205)
at _.extend.visitNode (packages/compileJade/plugin/compiler.js:81)
at _.extend.visitBlock (packages/compileJade/plugin/compiler.js:73)
at _.extend.compile (packages/compileJade/plugin/compiler.js:21)
at sourceHandler (packages/compileJade/plugin/handler.js:11)
/usr/local/lib/node_modules/meteorite/lib/command.js:41
throw "Command exited with " + code + "/" + signal;
^
Command exited with 1/null
To prevent reactivity from taking place on certain parts of jade code, I have read you can next the code inside a constant block.
But in jade when trying to use the constant block I get an error:
constant
#full-editor !{researchThread.draftHTML}
with handlebars you can use
{{> yield}}
to have a layout wrap a component, i was wondering if theres a similar syntax for meteor-jade.
Hi! Can component args be set across multiple lines?
This code works:
+autoForm(collection="Goals" id="updateGoalForm" type="update" template="bootstrap3-horizontal" role="form")
But this causes "Unexpected identifier" error:
+autoForm(collection="Goals" id="updateGoalForm" type="update"
template="bootstrap3-horizontal" role="form")
Here is the link to that package: https://atmospherejs.com/package/handlebar-helpers
Good day!
Today I updated meteor-jade to the latest commit. The application crashed with the errors below. Didn't matter if I commented the contents of the files out.
When I reverted back to tag 0.2.2 everything ran as normal.
While building the application:
<runJavaScript-39>:32:53: Cannot read property '1' of null (compiling cli
ent/views/viewtype/manage/manage-survey/templates/manage-survey-create.ja
de)
at unwrap (<runJavaScript-39>:32:53)
at Object.Lexer.builtInComponents (<runJavaScript-39>:43:16)
at Object.Lexer.next (<runJavaScript-39>:65:15)
at Object.Lexer.lookahead (/home/codio/.meteorite/packages/jade/mquanda
lle/meteor-jade/38220544108cdc30e2e53f40481dce0b594d6f31/.build/plugin.co
mpileJade.os/npm/compileJade/plugin/node_modules/jade/lib/lexer.js:114:46
)
at Parser.lookahead (/home/codio/.meteorite/packages/jade/mquandalle/me
teor-jade/38220544108cdc30e2e53f40481dce0b594d6f31/.build/plugin.compileJ
ade.os/npm/compileJade/plugin/node_modules/jade/lib/parser.js:100:23)
at Parser.peek (/home/codio/.meteorite/packages/jade/mquandalle/meteor-
jade/38220544108cdc30e2e53f40481dce0b594d6f31/.build/plugin.compileJade.o
s/npm/compileJade/plugin/node_modules/jade/lib/parser.js:77:17)
at Parser.block (/home/codio/.meteorite/packages/jade/mquandalle/meteor
-jade/38220544108cdc30e2e53f40481dce0b594d6f31/.build/plugin.compileJade.
os/npm/compileJade/plugin/node_modules/jade/lib/parser.js:685:30)
at Parser.tag (/home/codio/.meteorite/packages/jade/mquandalle/meteor-j
ade/38220544108cdc30e2e53f40481dce0b594d6f31/.build/plugin.compileJade.os
/npm/compileJade/plugin/node_modules/jade/lib/parser.js:806:26)
at Parser.parseTag (/home/codio/.meteorite/packages/jade/mquandalle/met
eor-jade/38220544108cdc30e2e53f40481dce0b594d6f31/.build/plugin.compileJa
de.os/npm/compileJade/plugin/node_modules/jade/lib/parser.js:719:17)
at Parser.parseExpr (/home/codio/.meteorite/packages/jade/mquandalle/me
teor-jade/38220544108cdc30e2e53f40481dce0b594d6f31/.build/plugin.compileJ
ade.os/npm/compileJade/plugin/node_modules/jade/lib/parser.js:188:21)
at Parser.parseExpr (/home/codio/.meteorite/packages/jade/mquandalle/me
teor-jade/38220544108cdc30e2e53f40481dce0b594d6f31/.build/plugin.compileJ
ade.os/npm/compileJade/plugin/node_modules/jade/lib/parser.js:227:21)
at Parser.block (/home/codio/.meteorite/packages/jade/mquandalle/meteor
-jade/38220544108cdc30e2e53f40481dce0b594d6f31/.build/plugin.compileJade.
os/npm/compileJade/plugin/node_modules/jade/lib/parser.js:689:25)
at Parser.tag (/home/codio/.meteorite/packages/jade/mquandalle/meteor-j
ade/38220544108cdc30e2e53f40481dce0b594d6f31/.build/plugin.compileJade.os
/npm/compileJade/plugin/node_modules/jade/lib/parser.js:806:26)
at Parser.parseTag (/home/codio/.meteorite/packages/jade/mquandalle/met
eor-jade/38220544108cdc30e2e53f40481dce0b594d6f31/.build/plugin.compileJa
de.os/npm/compileJade/plugin/node_modules/jade/lib/parser.js:719:17)
at Parser.parseExpr (/home/codio/.meteorite/packages/jade/mquandalle/me
teor-jade/38220544108cdc30e2e53f40481dce0b594d6f31/.build/plugin.compileJ
... etc
Currently we use each
to loop over a list or a cursor. each
works by setting the context (this
) to the current element inside the block of content. If you want to access a variable outside of this context you have to use the ../
notation.
For some cases this may be a non-intuitive syntax. For instance consider a table where each cell has a x
and an y
coordinate. Currently we would do:
Template.table.helpers({size: _.range(10)});
template(name="table")
table
each size
tr
each size
td #{..} #{.}
It would be more natural to use a for element in list
loop to avoid the dot notation:
template(name="table")
table
for x in size
tr
for y in size
td #{x} #{y}
Any thought?
When I try call helper, it causes an error.
Your app is crashing. Here's the latest log.
=> Errors prevented startup:
While building the application:
packages/html-tools/scanner.js:45: Expected identifier, number, string, boolean, or null
{{getTime(date)}}
^ (compiling client/views/blocks/chat/chat.jade.html)
UI.registerHelper('getTime', function(time) {
return time ? moment(time).format('L / HH:mm') : null;
});
each messages
p
a(href='/users/#{username}')
strong.text-info #{username}
| :
=message
p.text-right.text-muted= getTime(date)
Hi, it would be nice to implement something like
if anyHelper(arg1, arg2, arg3, ...)
div(class=anyHelper(arg1, arg2, arg3, ...))
h1= anyHelper(arg1, arg2, arg3, ...)
h1 #{anyHelper(arg1, arg2, arg3, ...)}
When trying to use dynamic attributes, I get the following error:
Exception from Deps recompute function: Error: The basic HTML.TransformingVisitor does not support foreign objects in attributes. Define a custom visitAttributes for this case.
at HTML.TransformingVisitor.def.visitAttributes (http://localhost:3000/packages/htmljs.js?fcf2660be84fbc0c33b97ee8932dbd46612f3566:212:13)
at Blaze.HTMLJSExpander.def.visitAttributes (http://localhost:3000/packages/blaze.js?ce45a8e727ecde8642e599cbb8eb3f52cea9ba4b:1897:63)
at Object.Blaze._expandAttributes (http://localhost:3000/packages/blaze.js?ce45a8e727ecde8642e599cbb8eb3f52cea9ba4b:1919:32)
at updateAttributes (http://localhost:3000/packages/blaze.js?ce45a8e727ecde8642e599cbb8eb3f52cea9ba4b:1369:35)
at http://localhost:3000/packages/blaze.js?ce45a8e727ecde8642e599cbb8eb3f52cea9ba4b:1738:16
at Object.Blaze.withCurrentView (http://localhost:3000/packages/blaze.js?ce45a8e727ecde8642e599cbb8eb3f52cea9ba4b:1963:12)
at viewAutorun (http://localhost:3000/packages/blaze.js?ce45a8e727ecde8642e599cbb8eb3f52cea9ba4b:1737:18)
at Deps.Computation._compute (http://localhost:3000/packages/deps.js?d9b2b2601bdab0f57291b38e7974a7190b8aac01:214:36)
at new Deps.Computation (http://localhost:3000/packages/deps.js?d9b2b2601bdab0f57291b38e7974a7190b8aac01:148:10)
at Object.Deps.autorun (http://localhost:3000/packages/deps.js?d9b2b2601bdab0f57291b38e7974a7190b8aac01:362:11)
Here is my smart.json:
{
"meteor": {
"git": "https://github.com/meteor/meteor.git",
"branch": "blaze-refactor"
},
"packages": {
"jade": {
"git": "https://github.com/mquandalle/meteor-jade",
"branch": "blaze-refactor"
},
"iron-layout": {
"git": "https://github.com/EventedMind/iron-layout.git",
"branch": "master"
},
"iron-router": {
"git": "https://github.com/EventedMind/iron-router.git",
"branch": "feature/iron-layout"
},
"underscore-string-latest": {}
}
}
template(name='home')
- var friends = 10
case friends
when 0
p you have no friends
when 1
p you have a friend
default
p you have #{friends} friends
=> Errors prevented startup:
While building the application:
<runJavaScript-42>:245:39: Property 'visitWhen' of object [object Object] is not a function
I'm trying to get the basic meteor create app
template running with both coffeescript and jade. I'm using meteor's coffeescript package. I have translated the standard app.js file to an app.coffee and the app.html file to app.jade.
The problem is that with app.coffee and app.jade the coffeescript sees Template.hello as undefined. This runs fine for html+coffee and for jade+js so my code is correct (here it is in a gist though ). It also works if I include both html and jade with the coffeescript file.
The error makes sense if meteor is compiling these in the following order: html, coffee, jade, js . However, I'm new to meteor and do not know how to tweak the order in which it runs everything.
I'm getting the following error message:
While building the application: packages/compileJade/plugin/compiler.js:296:
Unknow tag: template on line 5 (compiling test.jade)
Jade FIle
head
title test
body asdf
template(name='hello')
input(type='button', value='Click')
More Logs
at _.extend.throwError (packages/compileJade/plugin/compiler.js:296)
at _.extend.visitTag (packages/compileJade/plugin/compiler.js:131)
at _.extend.visitNode (packages/compileJade/plugin/compiler.js:89)
at _.extend.visitBlock (packages/compileJade/plugin/compiler.js:73)
at _.extend.visitNode (packages/compileJade/plugin/compiler.js:83)
at _.extend.visitBlock (packages/compileJade/plugin/compiler.js:73)
at _.extend.visitNode (packages/compileJade/plugin/compiler.js:83)
at _.extend.visitBlock (packages/compileJade/plugin/compiler.js:73)
at _.extend.compile (packages/compileJade/plugin/compiler.js:21)
at sourceHandler (packages/compileJade/plugin/handler.js:11)
Thank!
i noticed you can call a component with non-named params
+ttip arg1, arg2, arg3, key1=val1, key2=val2
but how do i pick up those params inside my component?
template(name="ttip" arg1 arg2 )
# will fail on compilation
While building the application:
<runJavaScript-40>:452:11: Templates must only have a "name" attribute
on line 4 (compiling client/komik/panels/kcap.jade)
i tried this.args[0] but not sure what else to look at!
I'm getting a weird error when using meteor-jade.
Uncaught Error: Expected null or template in return value from inclusion function, found:
I have the following in my chat.jade
file:
head
title Chat
body
+chats
template(name="messages")
ul.messages
each message in messages
li= message.body
template(name="chats")
.chats
+messages
form
input(placeholder="Type to chat...")
button Send
The error occurs when I have +messages
called from inside my chats
template.
If I remove that line I don't get an error.
Other template names work.
I also have a template attribute named messages, but that was working fine using Handlebars, so not sure why it would fail in Jade.
Here's what I see in my current project and in a simple dummy project just to use as a control.
$ mrt add jade
โ jade
tag: https://github.com/mquandalle/meteor-jade.git#v0.1.3
Done installing smart packages
Stand back while Meteorite does its thing
Done installing smart packages
Ok, everything's ready. Here comes Meteor!
compileJade: updating npm dependencies -- jade, markdown...
=> Errors while scanning packages:
While building package `jade`:
packages/compileJade/plugin/compiler.js:126: HTML is not defined (compiling tests/tests.jade)
at _.extend.visitTag (packages/compileJade/plugin/compiler.js:126)
at _.extend.visitNode (packages/compileJade/plugin/compiler.js:90)
at _.extend.visitBlock (packages/compileJade/plugin/compiler.js:74)
at _.extend.visitNode (packages/compileJade/plugin/compiler.js:84)
at _.extend.visitBlock (packages/compileJade/plugin/compiler.js:74)
at _.extend.compile (packages/compileJade/plugin/compiler.js:21)
at sourceHandler (packages/compileJade/plugin/handler.js:11)
While building plugin `compileJade` in package `jade`:
error: no such package: 'html-tools'
error: no such package: 'spacebars-compiler'
I don't know if this worked before. It is the first time I'm trying to add it with mrt. I'll now try adding it manually to my project.
p
| foo
| bar
Produces:
<p>foobar</p>
Which I don't think is correct. The native jade compiler produces:
<p>
foo
bar
</p>
It would be nice if a space or a newline could be added automatically. Currently, the workaround is to add extra indentation after the second pipe which is a little annoying. Can this be fixed?
It causes an error.
I receive the following error:
Uncaught TypeError: Cannot read property 'push' of undefined localhost:3000/NewRelease.jade.js?711b990fdee4a4f3d51b337f8ed4d458bcd67d35:2
Seems like the UI.body
isn't found. The code hangs here in the browser:
(function(){
UI.body.contentParts.push(UI.Component.extend({render: (function() {
Either of the following:
with address
span= streetAddress
br
span= addressLocality
span= addressRegion
span= postalCode
span= addressCountry
or:
template( name='address' )
span= streetAddress
br
span= addressLocality
span= addressRegion
span= postalCode
span= addressCountry
Produce HTML with no spaces between the <span>
tags. However, if you wrap them in an outer span, the line breaks are all preserved:
with address
span
span= streetAddress
br
span= addressLocality
span= addressRegion
span= postalCode
span= addressCountry
I'm not sure if this is an intentional feature to allow tags with no whitespace between them or a bug, but is there a solution that doesn't require wrapping these tags with an extraneous container?
It would be nice to escape variables in jade style, like this !{ variable }
instead of {{{ variable }}}
.
For example, with Iron Router:
a(href=pathFor('foo')) Foo
That doesn't work.
It would be useful to be able to define some kind of "anonymous helpers" like this:
if player.score > 10
p Well done!
As far as I know, it's not yet possible to define this kind of things in the Spacebars abstract tree. So maybe it's more a Spacebars feature? @dgreensp?
I just upgraded to Meteor 0.8. Previously I was doing that:
{{#with alert}}
div.alert(class="alert-{{type}}")
div.grid
div.g-row
div.g-c12
span.icon
{{message}}
span.close
{{/with}}
Is there a way to do this with meteor-jade?
While building package jade
:
packages/compileJade/plugin/compiler.js:155: Spacebars is not defined (compiling tests/match.jade)
at _.extend.parseText (packages/compileJade/plugin/compiler.js:155)
at packages/compileJade/plugin/compiler.js:212
at Array.forEach (native)
at Function._.each._.forEach (packages/underscore/underscore.js:105)
at _.extend.visitAttributes (packages/compileJade/plugin/compiler.js:205)
at _.extend.visitNode (packages/compileJade/plugin/compiler.js:81)
at _.extend.visitBlock (packages/compileJade/plugin/compiler.js:73)
at _.extend.compile (packages/compileJade/plugin/compiler.js:21)
at sourceHandler (packages/compileJade/plugin/handler.js:11)
I'm using the .travis.yml
file from https://github.com/arunoda/travis-ci-meteor-packages but I get a TypeError: Cannot read property 'name' of undefined
and tests don't run. Any idea why? @arunoda?
at the moment +UI.elseBlock
doesn't work.
Although {{>UI.elseBlock}}
is working fine
neither
div(class='large-##{this.input_size} columns left')
or
div(class='large-#'+this.input_size+' columns left')
works
Please tell me if there is anyway to do it.
It would be good if you would implement jade's case statment support
template(name='main')
case friends
when 0
p you have no friends
when 1
p you have a friend
default
p you have #{friends} friends
I would like to make a component that will provide translated tooltips
so I have a Template helper of trans(sometext)
but how to pass this to a jade component?
eg using bootstrap tooltip where title=XX
is needed
template(name="ttip")
a(href="#" rel="tooltip" title=trans(this.text) )
= this.text
gives error:
<runJavaScript-25>:130:11: Expected identifier, number, string, boolean, or null
{{trans(this.text)}}
i tried various other combos
title=this.text # ok
title=trans this.text #no good
even trying a temporary javascript variable:
template(name="ttip")
script.
var tr="blah {{ trans this.text }}";
console.log("tr:", tr)
a(href="#" rel="tooltip" title=this.text )
= this.text
in this case the var tr gets set but i guess its a different this in scope.
eventually i did this hack:
a(href="#" rel="tooltip" title=this.text.trans )
and monkeypatching a trans method onto my string class. I guess it works, and isn't too ugly, but would like to know a more jade way to do this.
is there a way to access array items in meteor/jade ?
there seem to be some handlebars/spacebars access syntax that isn't supported by jade
array elements in handlebars can be used like:
items.[0]
see this SO question
so within jade files i can use the handlebars escape to use this syntax like:
{{ items.[0] }}
however, when passing a value to a jade helper like an tag...
a(href=item.[0]) blah
the same syntax fails.
is there another way to access array items, or use the raw handlebars syntax in helpers?
For now jade only supports ()
for the attribute brackets. I would prefer to use []
since it's more coherent with jQuery and CSS selectors.
As of issue pugjs/pug#1307, jade core may consider the change for v2, but not until then. Since this meteor-jade package is quite new, I wonder if you have any objection about the implementation of both ()
and []
syntax support?
I seem to be having some troubles getting autoform working with Jade, would love to be able to use both. Writing something like this: +autoForm(schema=signupFormSchema,type="method",meteormethod= "signupUser")
+afFieldInput(name="Username")
returns an "Expected space ...ema= signupFormSchema, type= "method"" error. Is using autoform possible with Jade? If so, I guess I'll just have to dig harder then. I'll keep poking at it either way.
v0.2.2 somehow thinks iframe is {{>if rame ...}}
Sample Code:
iframe(width="530" height="352" src="https://www.youtube.com/embed/M35XqOLDKZY" frameborder="0" allowfullscreen="")
Error:
packages/html-tools/scanner.js:45: Expected space
{{>if rame(width="530", height...
^ (compiling client/views/shared/modals.jade)
at Scanner.fatal (packages/html-tools/scanner.js:45)
at error (packages/spacebars-compiler/templatetag.js:218)
at expected (packages/spacebars-compiler/templatetag.js:222)
at Function.TemplateTag.parse (packages/spacebars-compiler/templatetag.js:286)
at _.extend.visitMixin (packages/compileJade/plugin/compiler.js:110)
at _.extend.visitNode (packages/compileJade/plugin/compiler.js:89)
at _.extend.visitBlock (packages/compileJade/plugin/compiler.js:73)
Expected end tag error in markdown "automatic links":
% meteor --version
Release 0.8.0
% meteor
...
While building the application:
<runJavaScript-6>:130:11: Expected "[email protected]" end tag
...t <[email protected]>
^ (compiling client/views/contact.jade)
at [object Object].Scanner.fatal (<runJavaScript-6>:130:11)
at HTMLTools.Parse.getContent (<runJavaScript-6>:3351:19)
at Object.HTMLTools.parseFragment (<runJavaScript-6>:3219:14)
at Object.Spacebars.parse (<runJavaScript-20>:829:24)
at [object Object]._.extend.parseText (<runJavaScript-21>:293:22)
at [object Object]._.extend.visitText (<runJavaScript-21>:283:28)
at [object Object]._.extend.visitNode (<runJavaScript-21>:236:39)
at [object Object]._.extend.visitBlock (<runJavaScript-21>:220:24)
at [object Object]._.extend.visitNode (<runJavaScript-21>:230:51)
at [object Object]._.extend.visitBlock (<runJavaScript-21>:220:24)
at [object Object]._.extend.visitNode (<runJavaScript-21>:230:51)
at [object Object]._.extend.visitBlock (<runJavaScript-21>:220:24)
at [object Object]._.extend.compile (<runJavaScript-21>:168:10)
at sourceHandler (<runJavaScript-21>:460:46)
=> Your application has errors. Waiting for file change.
i've noticed various cases where jade recommended tag doesn't work
this example is a bit edge casey but have seen in other simpler cases too.
script.
var tr="blah #{ trans this.text }";
# -> tr: blah #{ trans this.text }
script.
var tr="blah {{ trans this.text }}";
#-> calls my trans method correctly and gets result
=> Started proxy.
=> Started MongoDB.
Warning: missing space before text for line 9 of jade file "null"
=> Meteor 0.7.1.2 is available. Update this project with 'meteor update'.
=> Started your app.
The jade file name is 'main.jade.html'
Is Iron Router supported for this? I've been trying to use it and have been unsuccessful in getting the layouts to work so far, using both the shark and cmather branches of Iron Router. I'm running Meteor from the shark branch as well.
Hey there,
I have a chunk of jade code that looks like this :
p | something a(href='link', target="_blank") b boldtext, | another line
On v0.2.2, it renders everything in a sentence without line breaks. However, on 0.2.4, somehow line breaks are appearing between "| something", "a(href ..." and "| another line".
I'm trying to output some info using buffered code:
.info= JSON.stringify(this)
But I'm getting:
<runJavaScript-26>:130:11: Expected identifier, number, string, boolean, or null
{{JSON.stringify(this)}}
^ (compiling chat.jade)
Hello,
Is there a way to do something like that?
if retention = 1 or retention = 3 or retention = 21
p Your retention is equal to 1, 3 or 21
Or maybe would it better to do the logic inside my helper?
if retention = "accepted"
p Your retention is equal to 1, 3 or 21
When using blaze refactor with meteor 8.1.3 there is an error preventing startup.
Cannot call method 'apply' of undefined (compiling tests/match.jade)
I need to make dynamic attribute work in my app. Please help.
+myTemplate arg1=arg1 arg2=arg2
does not work:
While building the application:
<runJavaScript-6>:130:11: Expected space
{{>myTemplate arg1=arg1,}}
Per the Blaze wiki:
"New: (Notably, in Blaze, keyword arguments to inclusion or block helpers are bundled into a single object which becomes the new data context)"
The example given on the Wiki happens to be a dynamic template rendering pattern, which makes this seem more complicated than it actually is, but it's clear that keyword arguments are bundled into the data context and are accessible from the template.
As expected, the following works:
{{> myTemplate arg1=arg1 arg2=arg2}}
When defining a route with an :_id field using iron-router
@route 'postPage',
path: '/posts/:_id'
data: ->
Posts.findOne @params._id
and adding the route into the jade page like so:
a.discuss.btn(href="{{pathFor 'postPage'}}") Discuss
does not work. What happens is jade just gets rid of the whole href attribute and the button does not link to anywhere. In the html there is no more href attribute. It is supposed to put in the path for the postPage + id of the post appended.
It seems like an issue with the path having an _id field in it. When I remove the _id filed, it puts in the correct route but I need the _id field for dynamic routing
UPDATE:
I found a way to make it work, like this:
a.discuss.btn(href="{{pathFor 'postPage' _id=this._id}}") Discuss
But I in the book Discover Meteor, it says Iron router should automatically detect that the route specified requires an id field, so it checks the data context in the spot it is located and adds the _id field if neccessary. So
1)
a.discuss.btn(href="{{pathFor 'postPage'}}") Discuss
is equivalent to
2)
a.discuss.btn(href="{{pathFor 'postPage' _id=this._id}}") Discuss
Using the second way works right now but the first method does not.
I have something like this:
<template name="postList">
<div class="post-list">
{{#each posts}}
{{> postItem}}
{{/each}}
</div>
</template>
when turned into:
template(name='postList')
.post-list
each posts
+postItem
The list items don't display anymore.
Am I doing something wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.