1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. 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 {}

Discussion in 'Development Tutorials [Archive]' started by cclaerhout, Dec 1, 2011.

  1. cclaerhout

    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
    Replace ALL:
    => 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:
    That's great !
    Fuhrmann likes this.
  2. Fuhrmann

    Fuhrmann Well-Known Member

    Good to know about this.
  3. cclaerhout

    cclaerhout Well-Known Member

    Thanks. Here is an example for the color in JS:

    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.
    Fuhrmann likes this.

Share This Page