1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[solved] TMS: 4.000 replacements for EXTRA.css

Discussion in 'XenForo Development Discussions' started by Marcus, Aug 13, 2015.

  1. Marcus

    Marcus Well-Known Member

    I append a simple template add_EXTRA.css to the EXTRA.css with the following Template Modification:

    Template: EXTRA.css
    Regexp: /[.]*/
    Replace with: $0 <xen:include template="add_EXTRA.css" />

    Now there are over 4000 replacements (in green) shown. I do not understand this.
  2. HWS

    HWS Well-Known Member

    Each single character in EXTRA.css has been replace one time.

    Use #^.*$# instead.
    Marcus likes this.
  3. Marcus

    Marcus Well-Known Member

    Thanks for your tip, /.*/ works much better with only a few hundred replacements.

    Your /^.*$/ doesnt apply everything, it should stop after one line break.
  4. Snog

    Snog Well-Known Member

    Silly question, why not just include it in PAGE_CONTAINER with <xen:require css="add_EXTRA.css" />?
    Daniel Hood likes this.
  5. katsulynx

    katsulynx Well-Known Member

    I use the following regular expression to select everything:
    Marcus likes this.
  6. Marcus

    Marcus Well-Known Member

    Perfect, that works with only 2 replacements now. Down from over 4.000 :)
  7. Xon

    Xon Well-Known Member

    If you want to append/prepend something, then the following regex is simpler (and faster);
    Just reference $0 as the replaceable.
    katsulynx and Marcus like this.
  8. Marcus

    Marcus Well-Known Member

    Awesome, thanks!
  9. katsulynx

    katsulynx Well-Known Member

    Hit the counter to see how many replacements are done in which style. Normally the minimum number of replacements would be the number of distinct templates of the same name you have across your styles. So if you have two styles with the same register_form, you'd hit one replacement minimum, while in the following example my custom style has an altered register_form template and therefor shows up with 2/0/0, splitted down to the following:

    Marcus likes this.

Share This Page