arnaud-lb / MtHaml

Multi target HAML (HAML for PHP, Twig, <your language here>)
Other
359 stars 54 forks source link

nesting within interpolated string is illegal in site #108

Open dcnl1980 opened 5 years ago

dcnl1980 commented 5 years ago

I'm using Laravel 5.7 clean installation, and while trying to add this package with composer, add it to the app.php as Service Provider. The template is giving: "a nesting within interpolated string is illegal in site". Any ideas how to solve this? It seems php 7.1 related.

dcnl1980 commented 5 years ago

I got it running, the tabs where making the script not working. So I removed after tab in the lines. But I got another problem.

I have a file colours.haml, it's rendering correctly but it's render it to php which is not supporting it at all.

Code:

- @colors = ['blue', 'indigo', 'purple', 'pink', 'red', 'orange', 'yellow', 'green', 'teal', 'cyan', 'gray', 'gray-dark'];
- @variants = ['100', '200', '300', '400', '500', '600', '700', '800', '900'];

Output:

<?php @colors = ['blue', 'indigo', 'purple', 'pink', 'red', 'orange', 'yellow', 'green', 'teal', 'cyan', 'gray', 'gray-dark']; ?>
<?php @variants = ['100', '200', '300', '400', '500', '600', '700', '800', '900']; ?>
srpatel commented 4 years ago

For PHP, you should be using $ to prefix variables (@ is used for class variables in Ruby, and is not a Haml-specific thing).