Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class shorthand does not work when expressions are in coffeescript #1090

Closed
antoinegoutagny opened this issue Aug 5, 2015 · 4 comments
Closed
Assignees

Comments

@antoinegoutagny
Copy link
Contributor

The class shorthand does not work when expressions are in coffee. The following tag:

<my-tag>
    <div class={ className: true }>Hello</div>
</my-tag>

When run through the compiler with the -t coffee --expr options, is translated to the following:

riot.tag('my-tag', '<div class="{({ className: true })}">Hello</div>', function(opts){})

Hence in the update(expressions, tag) method, expr is an object and the attribute is removed from the DOM instead of being updated.

One workaround is to compile tags without the --expr option and write expressions in pure JS instead of coffee. That isn't too cumbersome since expressions are supposed to be simple, but there's the overhead of switching between coffee and js depending on the part of the tag we're in.

@aMarCruz
Copy link
Contributor

This is not a bug, it is a design conflict ;)
Anyway, there will be an option to disable preprocessing at expression level.

@antoinegoutagny
Copy link
Contributor Author

Well, there's already an option to disable preprocessing at expression level, it's the --expr flag (or its absence).

@aMarCruz
Copy link
Contributor

yeah, I mean disable the option only in certain expressions (i.e. shorthands)
something like {^ myclass: true }

@aMarCruz
Copy link
Contributor

I'm closing this issue, new compiler will support exclusion of preproc with the caret, just like in the above example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants