JS variable values not quoted anymore


Since the last release, the JS variable values are not quoted by default.
Your doc says " By default, the value is wrapped in “quotes” to create a string. Use the type attribute for other value types: number , array (or list ), object (or map ), and raw . (These all work the same by passing unquoted value.)"

This doesn’t work anymore. I have to force the quote in code to fix the JS script generated. Example :

<Set js=af2>"<Field title />"</Set>

@eliot, can you have look to this please ?


Hey Guillaume, you’re totally right. In the changelog for 3.1.1, it mentions “JavaScript and Sass variable types: Make default value type “raw” (unquoted) instead of “string” (quoted).” The docs have now been updated to reflect this, so while your approach is entirely valid, another way to achieve this would be by writing <Set js=af2 type=string><Field title /></Set>

I asked Eliot about this and he mentioned that while he was hesitant to introduce any backward incompatible change with this release, he acknowledged that based on some conversations with users, using unquoted values as the default value type was more intuitive and easier to use, mainly because strings are much less commonly used in Sass than colors, URLs, and other unquoted values. That decision was compounded by the fact that Sass variables already weren’t working properly in the previous version (as evidenced by this thread) so people already weren’t able to get the most flexibility out of those variables even before the 3.1.1 update. It also kinda makes the plugin more consistent since all other L&L variables are unquoted (i.e. they’re passed exactly as they’re written) by default, which makes intuitive sense.

I hope that all makes sense and I’m sorry for the hiccup this caused in your templates! I would have wanted to communicate that better but there was a communication lapse with people out on holiday when the update was released. Always a tricky balance to maintain solid communication about a plugin that’s being provided for free, but the ultimate goal is to make sure the plugin is built in the most sensible future-proof way possible while listening to user feedback. Let me know if you have any feedback about this and I’ll be sure to pass it along to the team! Thanks for bringing this up :slight_smile:

Hi Benjamin, thanks a lot for your quick and detailed answer. I totally understand your dilemna and even if you had communicate about this evolution, I am not sure I will have seen it. Maybe an email to the beta users who have subscribed on your site with a list of non retro-compatible changes before a version upgrade could be an good idea. Updating your documentation with some “deprecated” or “non-compatible” temporary alerts on big changes could be useful as well. :slightly_smiling_face:

In my case - for your info - this evolution broked a custom dataLayer script generated with L&L. We lost 5 days of conversions tracked in Google Tag Manager, Google Ads… quite painful actually just before a weekend and during the Christmas holidays ! Next critical release like this one should be planned on monday or tuesday of a standard working period. imo

Concerning the evolution on “Javascript and Sass variable”, I think your approach is right technically speaking. The “raw” type should be the default one indeed (that’s what I spontaneously thought at the beginning, then I’ve read the doc carefully to discover that default type was the string one) and adding type=string in order getting a quoted values seems perfectly fine for me. I’ll test it right now.

Thanks again for your amazing work with this plugin, it’s a real game changer for Wordpress marketers and front devs. :muscle: :+1:

1 Like

I totally hear you, thanks for the follow-up! And yeah, I sent out an email to beta users back in September about the 3.0.0 update and I was hoping to continue that trend with all major and minor updates (probably skipping patch updates), but it seems like Eliot kinda snuck this update out while we were all dreaming of sugar-plums haha! Thanks for understanding :slight_smile: Happy new year!

1 Like