Comments (28)
I think it's a good idea, I'll implement it asap.
from react.hiccup.
Done
from react.hiccup.
wow, that was FAST! many thanks.
from react.hiccup.
sorry I got a hiccup to get this working. I did the following steps:
(1) update: sudo npm update -g react.hiccup
(2) verify: that it's the same version as on github: 0.1.3
(3) create a minimal test file test.hiccup.js:
rclass Test = {
render: function() {
return hiccup [div.a-b "123"]
}
}
(4) compile: sjs -m react.hiccup/macros -o test.js test.hiccup.js
and got the following error:
/usr/lib/node_modules/sweet.js/lib/parser.js:4982
throw e$1654;
^
Error: Line 1: Unexpected token ,
[... , - , b , 123 ...]
at throwError$929 (/usr/lib/node_modules/sweet.js/lib/parser.js:1887:26)
at throwUnexpected$931
(/usr/lib/node_modules/sweet.js/lib/parser.js:1939:9)
at parsePrimaryExpression$950
(/usr/lib/node_modules/sweet.js/lib/parser.js:2295:16)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at trackLeftHandSideExpressionAllowCall$1032
(/usr/lib/node_modules/sweet.js/lib/parser.js:4227:74)
at parsePostfixExpression$959
(/usr/lib/node_modules/sweet.js/lib/parser.js:2381:25)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at parseUnaryExpression$960
(/usr/lib/node_modules/sweet.js/lib/parser.js:2430:16)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at parseUnaryExpression$960
(/usr/lib/node_modules/sweet.js/lib/parser.js:2418:25)
shell returned 8
Could you please give a hint what I am doing wrong?
thank you
from react.hiccup.
Argh, I forgot to copy the file under src/ to macro/index.js upon release.
My bad.
For now just do
sjs -m react.hiccup/src/react_hiccup.sjs -o test.js test.hiccup.js
Later I'll fix the release.
On Feb 10, 2014 5:48 PM, "hanthethanh" [email protected] wrote:
sorry I got a hiccup to get this working. I did the following steps:
(1) update: sudo npm update -g react.hiccup
(2) verify: that it's the same version as on github: 0.1.3
(3) create a minimal test file test.hiccup.js:
rclass Test = {
render: function() {
return hiccup [div.a-b "123"]
}
}(4) compile: sjs -m react.hiccup/macros -o test.js test.hiccup.js
and got the following error:
/usr/lib/node_modules/sweet.js/lib/parser.js:4982
throw e$1654;
^
Error: Line 1: Unexpected token ,
[... , - , b , 123 ...]
at throwError$929 (/usr/lib/node_modules/sweet.js/lib/parser.js:1887:26)
at throwUnexpected$931
(/usr/lib/node_modules/sweet.js/lib/parser.js:1939:9)
at parsePrimaryExpression$950
(/usr/lib/node_modules/sweet.js/lib/parser.js:2295:16)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at trackLeftHandSideExpressionAllowCall$1032
(/usr/lib/node_modules/sweet.js/lib/parser.js:4227:74)
at parsePostfixExpression$959
(/usr/lib/node_modules/sweet.js/lib/parser.js:2381:25)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at parseUnaryExpression$960
(/usr/lib/node_modules/sweet.js/lib/parser.js:2430:16)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at parseUnaryExpression$960
(/usr/lib/node_modules/sweet.js/lib/parser.js:2418:25)shell returned 8
Could you please give a hint what I am doing wrong?
thank you
Reply to this email directly or view it on GitHub.
from react.hiccup.
sorry, my fault. New to npm, didn't know about its cache.
from react.hiccup.
cleaning cache didn't help, but your hint came to the rescue. thanks again.
from react.hiccup.
ok, deployed new version on npm, it should work as expected. Thanks
from react.hiccup.
sorry to bring up another issue:
this works: hiccup[div.abc-def "123"]
this doesn't work: hiccup[div.abc--def "123"]
why two dashes? Since it's the convention used by BEM
from react.hiccup.
Uh ok... I didn't know about BEM. I'll reopen the issue.
from react.hiccup.
can you please also support this: hiccup [div.calendar-view-4weeks "abc"]
? thanks.
from react.hiccup.
Will do asap.
from react.hiccup.
So, I just released a new version with better parsing of selectors, e.g. -- and numbers are allowed.
Turns out though that sweet.js refuses to parse things like "somestring", like "-4weeks". For some reason "-a4weeks", "-a4" "-4" work fine.
Anway, I'll investigate the issue in sweet.js, if that gets fixed react.hiccup will start working with any combination.
from react.hiccup.
I have updated and now even this doesn't work: hiccup [ div.abc-def "123"]
. I tried with sjs -m react.hiccup/src/react_hiccup.sjs
as well, same error. Any hint please?
from react.hiccup.
This is odd: react.hiccup version 0.1.6.
sjs -m react.hiccup/macros foo.js
with foo.js containing
hiccup [div.abc-def 123]
=> React.DOM.div({ className: ' abc-def' }, 123);
hiccup [div.abc-def "123"]
=> React.DOM.div({ className: ' abc-def' }, '123');
from react.hiccup.
I think I might miss something obvious, however could not figure it out. Here is what I get on my machine:
`
$ cat js/test.hiccup.js
rclass Test = {
render: function() {
return hiccup [div.abc-def 123]
}
}
$ sjs -m react.hiccup/macros -o js/test.js js/test.hiccup.js
/usr/lib/node_modules/sweet.js/lib/parser.js:4982
throw e$1654;
^
Error: Line 1: Unexpected token ,
[... , - , def , 123 ...]
at throwError$929 (/usr/lib/node_modules/sweet.js/lib/parser.js:1887:26)
at throwUnexpected$931 (/usr/lib/node_modules/sweet.js/lib/parser.js:1939:9)
at parsePrimaryExpression$950 (/usr/lib/node_modules/sweet.js/lib/parser.js:2295:16)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at trackLeftHandSideExpressionAllowCall$1032 (/usr/lib/node_modules/sweet.js/lib/parser.js:4227:74)
at parsePostfixExpression$959 (/usr/lib/node_modules/sweet.js/lib/parser.js:2381:25)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at parseUnaryExpression$960 (/usr/lib/node_modules/sweet.js/lib/parser.js:2430:16)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at parseUnaryExpression$960 (/usr/lib/node_modules/sweet.js/lib/parser.js:2418:25)
$ head /usr/lib/node_modules/react.hiccup/package.json
{
"name": "react.hiccup",
"version": "0.1.6",
"description": "Hiccup notation for React.js",
"repository": {
"type": "git",
"url": "https://github.com/lantiga/react.hiccup.git"
},
"keywords": [
"notation",
`
Do you have a suggestion what I should try? Thanks.
from react.hiccup.
update: I tried different versions to see the difference:
0.1.3: error
0.1.4: OK
0.1.5: OK
0.1.6: error
but 0.1.5 doesn't support --
yet
from react.hiccup.
Thank you for checking. I think I nailed the issue: it was due to pattern matching for the rclass macro not working correctly with the new hiccup macro version.
I just released 0.1.7, it's working for me. Can you try and see what happens?
Thanks
from react.hiccup.
ah, another useful hint, thanks. I have updated to 0.1.7, same error as 0.1.6, but now I leave out the rclass
macro and use React.createClass
instead. --
works fine now. I figured out the convenience brought by rclass
is not worthwhile the trouble it causes.
from react.hiccup.
Can you try out updating the package now?
from react.hiccup.
the rclass
macro works now, however these selectors don't:
[div.a__b--c 123] // ERROR
[div.a_b-c 123] // ERROR
[div.a_b-c 123] // ERROR
[div.a-b-c 123] // ERROR
from react.hiccup.
The following works for me, can you provide a sample that demonstrates the error you are getting?
rclass Test = {
render: function() {
return hiccup [div.a-b-c 123]
}
}
rclass Test = {
render: function() {
return hiccup [div.a__b--c 123]
}
}
from react.hiccup.
head /usr/lib/node_modules/react.hiccup/package.json
{
"name": "react.hiccup",
"version": "0.1.8",
"description": "Hiccup notation for React.js",
"repository": {
"type": "git",
"url": "https://github.com/lantiga/react.hiccup.git"
},
"keywords": [
"notation",
cat js/test.hiccup.js
var Test = React.createClass({
render: function() {
return hiccup
[div
[div.a__b--c 123] // ERROR
]
}
});
sjs -m react.hiccup/macros -o js/test.js js/test.hiccup.js
/usr/lib/node_modules/sweet.js/lib/parser.js:4982
throw e$1654;
^
Error: Line 3: Unexpected token ,
[... , -- , c , 123 ...]
at throwError$929 (/usr/lib/node_modules/sweet.js/lib/parser.js:1887:26)
at throwUnexpected$931 (/usr/lib/node_modules/sweet.js/lib/parser.js:1939:9)
at parsePrimaryExpression$950 (/usr/lib/node_modules/sweet.js/lib/parser.js:2295:16)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at trackLeftHandSideExpressionAllowCall$1032 (/usr/lib/node_modules/sweet.js/lib/parser.js:4227:74)
at parsePostfixExpression$959 (/usr/lib/node_modules/sweet.js/lib/parser.js:2381:25)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at parseUnaryExpression$960 (/usr/lib/node_modules/sweet.js/lib/parser.js:2430:16)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at parseUnaryExpression$960 (/usr/lib/node_modules/sweet.js/lib/parser.js:2406:25)
from react.hiccup.
Ok thanks a lot
from react.hiccup.
for now I stick with the following:
- use
React.createClass
instead ofrclass
- don't use
--
- use version 0.1.5
since this combination seems to work.
from react.hiccup.
Ok, I think I got it working, the errors you were getting were due to the nesting, which I wasn't testing correctly for. Do you have time for another test?
from react.hiccup.
sure. It seems to work now with --
and __
combined; I haven't tested the rclass
macro since I have decided to go without it. thanks for your prompt support.
from react.hiccup.
Good. Thanks for the interaction!
from react.hiccup.
Related Issues (10)
- please publish an npm module HOT 3
- Have you thought about babel ? HOT 4
- Have rclass generate the displayName specification automatically
- Implement multiline strings HOT 1
- Is it possible to use pass a string for the css selector? HOT 2
- typo for tag `button` HOT 1
- parameterize props HOT 1
- hiccup to jsx? HOT 2
- how to split large hiccup files? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react.hiccup.