-
Notifications
You must be signed in to change notification settings - Fork 77
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
Lucius/Cassius mixins #194
Comments
To clarify: luciusMixin in a quasiquoted lucius fragment works if I specify the type signature for the mixin. luciusMixin in a quasiquoted cassius fragment fails with unexpected end of input. My experience with Yesod & Shakespeare is limited, but it seems something is going wrong when handling interpolation in Cassius? |
Could you provide a Gist or similar demonstrating the full failing case? |
https://gist.github.com/okdewit/5c9e02def4d6b4e8793d35bc7ca74165 It's a very basic setup, after generating a scaffolded site I only changed some routing. I wanted to keep the sample homepage intact as a quick reference, so I made a route/handler/templates next to it called "main". I created a "Service" directory with a Mixin.hs and Theme.hs in it. Coming from PHP frameworks I felt like I should keep the controllers/handlers as clean as possible, so I wrote those snippets as modules, and registered them in the cabal file under exposed-modules. All of that works very well! If I keep the Mixin.hs file unchanged (with the cassiusMixin), change the file extension of the style template from main.cassius to main.lucius, and add the brackets, the mixin works! The main.cassius template also works as expected if I use a normal Text interpolation: #menu
background: #{menuBackground theme}; So I suspect that even though Cassius & Lucius use the same parser, Cassius just can't deal with the caret interpolation? |
Turns out that Lucius didn't have support for dealing with a trailing semicolon after a mixin. I've just pushed a commit to master that should fix this, can you test it out and confirm it works? Assuming you're building with Stack, you'll want to modify your stack.yaml to include the 7e3bbf7 commit of this repo with something like this in your - location:
git: https://github.com/yesodweb/shakespeare
commit: 7e3bbf700b2104e4297bcc6d49bcd05211a5ecc8
extra-dep: true |
It's really cool how easy Stack makes it to test a bugfix like this 👍 |
After adding the package location to stack.yaml and performing a |
Awesome, I've just released this to Hackage as 2.0.11.1. |
If I implement the Lucius mixin example:
I get a type error:
Which I solved by defining the type explicitly, although I do not know if this is correct.
Then, in a .lucius template file this works fine:
but in a .cassius file this doesn't, both with luciusMixin and cassiusMixin:
The text was updated successfully, but these errors were encountered: