• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Minified JS in templates : don't forget to escape curly brackets {}

cclaerhout

Well-known member
If you minify your JS script (see this online service) and paste it in your templates, you will get an error during saving the template. To avoid this, just add a space between and after curly brackets "{}".

If you've got a regex editor
Search:
Code:
([{}])
Replace ALL:
Code:
 $1
=> there is a space before and after the $1.

And everything will work :)

Oh, by the way, when you use JS script in template, you can use style property shortcuts inside code, ie:
Code:
@textCtrlText
or
Code:
@AnyOfYouCustomizedSetting
That's great !
 

cclaerhout

Well-known member
Good to know about this.
Thanks. Here is an example for the color in JS:

Code:
var colorbg_first = '@breadcrumbItemFirstCrumb.background-color';
var color_first = '@breadcrumbItemFirstCrumb.color';
So to have just one value of a class, just had a point (.) after the class called with the aerobase (@) sign.
 
Top