Closed lensco closed 8 years ago
This is true. I implemented that in order to keep things like
a(href='#')
i.fa.fa-fw.fa-gear
| Some Title
working correctly (Fucken inline-block auto-spacing...sometimes it makes sense, sometimes it's pretty annoying (e.g. navs)). The pretty-output works fine, what Tale Jade does is adding a space in front of such elements on purpose when not in pretty mode.
Any ideas for a way to have both possibilities? I'd not put it into an option for the compiler, since it restricts you globally.
I'd go for some kind of operator you put in front or at the end of something.
How about we use Node.js Jade's /
operator to force /
-style closing.
span/ foo
| bar
Tale Jade does that automatically with doctype-handling and a set of options.
Using it would avoid the auto-spacing. We could also make it activate auto-spacing.
What I do in regular Jade when I want a space is either 2 spaces after the pipe character:
span foo
| bar
Or like this:
span foo
= ' '
| bar
In the end it's a personal preference, but I quite like the default behavior of stripping whitespace. And since you're going for a complete port of Jade, I would expect them to behave the same?
Yep, that's exactly what I want to achieve, that's why the default behaviour will be changed to stripping whitespaces completely. I will patch it in this weekend. There will be no option and no new operator.
Sometimes you miss the forest for the trees, I actually didn't think once about just adding a damn space after the pipe.
Thank you :)
Meanwhile, feel free to use str_replace('> ', '', $phtml)
as a quick fix :)
👌🏼
I removed automatic space-insertion in 83eee44f49ec0550cc2899b2dfb06a907e0b6ef5, I guess you can test it already, the release will come soon (I will implement some more fixes first)
1.4.3 is released now, can you check if this is fixed for you please?
Cool. The whitespace is stripped now, but the double space trick doesn't work?
Okay, I re-released 1.4.3
You might need to clear your composer cache and delete your vendor directory.
Please try again :)
Yes, works now, thanks. But it seems setting the cache path no longer works? I have this, yet it still renders them to ./cache
?
$renderer = new Jade\Renderer([
'paths' => [__DIR__.'/build/views']
]);
The paths
variable is for the include paths of the jade files, to set the cache path use cache_path
or cache_dir
(I prefer path
, symfony prefers dir
, that's why it allows both :))
Right. All good now!
Considering this:
The offical Jade engine compiles this to:
While Tale Jade gives me this (regardless of the
pretty
output setting):So Tale Jade makes it rather hard to have the two parts joined without a space. One of the reasons I love Jade is that it always flattens whitespace, and you have to explicitly add spaces if you want them.