E
E
Evgeny Zhurov2019-03-28 13:12:41
css
Evgeny Zhurov, 2019-03-28 13:12:41

How to programmatically change a large number of css classes (preferably using Gulp)?

There was a task to add the same prefix to all css classes and IDs, for example, dd_
Project on Gulp, CSS is compiled from SASS, the Bulma framework is also connected to the project (it's like Bootstrap, if that). Not the entire Bulma file is used - and unused styles are removed through gulp-uncss. The output after assembly needs to be assigned these prefixes - including the framework classes.
Pug is also used - accordingly, all these prefixes should also appear in the final html. Fortunately, there are practically no scripts - you can rewrite them with your hands.
Is there some plugin or algorithm for Gulp to do this? If not, is there at least some source search/replace mechanism in Atom, Sublime, or Notepad?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
tyzberd, 2019-03-28
@Zhuroff

found this.
https://www.npmjs.com/package/gulp-class-prefix
https://www.npmjs.com/package/gulp-html-prefix

A
Alexey Ukolov, 2017-01-04
@alexey-m-ukolov

The question is how best to do it.
Looking for what is better.
As for the convenience of writing code, you yourself must decide, the convenience is different for everyone.
The complexity of further support depends on the table and how you write the code (in any case, you can write both crookedly and well).
By speed - depends on the data and the table, make two options and measure the performance of each if it is important.

S
spafix, 2017-01-04
@spafix

https://learn.javascript.ru/multi-insert

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question