Global Search And Replace

Talk about new features for CMSMS and modules.
Post Reply
Zippo
Forum Members
Forum Members
Posts: 15
Joined: Mon Jan 31, 2022 12:19 am

Global Search And Replace

Post by Zippo »

I’m new here and new to CMSMS so I apologize if this has been suggested but I would love to have a global search and replace function. It would be great to search all templates and/or style sheets for #fefefe and replace it with #cecece for example.
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1380
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Global Search And Replace

Post by DIGI3 »

A global search and replace would be handy but I think would have to come with a version control for "undo" as well, given the damage it could do. That's a pretty massive undertaking but perhaps a module developer would want to take it on.

In the meantime, that's a great reason to use variables for styles, so you only need to change something in one place. In a stylesheet you would do something like:

Code: Select all

[[$mybackground = '#fefefe' scope=global]]
.link {
  background-color: [[$mybackground]];
}
.button {
  background-color: [[$mybackground]];
}
then to change everything using #fefefe you'd only need to edit the first line. The scope=global makes it available to your other stylesheets, assuming this is the first one in the list. (There's other ways of doing this, and you can get into using modules and/or content blocks to give your client a simple theme editor, but this is the gist of it)
Not getting the answer you need? CMSMS support options
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3404
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Global Search And Replace

Post by velden »

Although I've never used it myself I'd consider using CSS custom properties for this specific example.
https://developer.mozilla.org/en-US/doc ... properties
Zippo
Forum Members
Forum Members
Posts: 15
Joined: Mon Jan 31, 2022 12:19 am

Re: Global Search And Replace

Post by Zippo »

Thanks for the very helpful replies.
Post Reply

Return to “Feature ideas”