How to cache css styles?

In the folder web/css, I have a bunch of files with a large number of styles in each file.

Some styles need some hanging idle.

Question, is it possible somehow, to pull out of all of these files are only used styles???

For example I went to the page and it hop, in a separate folder (e.g. cach/css) saved the file with those styles that were on this page... And then just glue them, and get single file.
June 3rd 19 at 19:40
3 answers
June 3rd 19 at 19:42
How the comp will determine what styles are used? It's quite a challenge: inherited styles are added dynamically using js.

It's too much. Use webpack / gulp to collect all in 1 min file and this file will be cached by the browser.
June 3rd 19 at 19:44
It takes into account the styles that are added dynamically with js? - Pablo63 commented on June 3rd 19 at 19:47
who is he? my search query? - hailee commented on June 3rd 19 at 19:50
that is you do not know how this works, but sent to Google? oO - Pablo63 commented on June 3rd 19 at 19:53
I opravil person to Google since it is question is duplicated including the toaster - it is visible in the search request + sent it, if it is difficult to make a search request(problem 90% asking questions here).

If you are very interested in my experience in this matter - I do not write styles that will not be used, so you do not Kachitsa with extra-tuling. - hailee commented on June 3rd 19 at 19:56
me too. I just went through your link. The first site - library unused css. I was just wondering how exactly to operate these tools. Download, and using their laziness. I thought you might know - Pablo63 commented on June 3rd 19 at 19:59
June 3rd 19 at 19:46
Here's Your error:
on each page its own set of css. You can do each just the right feed to the browser's css file. But since browsers cacheroot resources such as css, it turns out that it's less optimal. 1 cached file with all the css often works more quickly and reduces the requests to the server than a lot of small, but "requiring myself to upload".
There are many really intelligent optimization and you can write a book (critical css + asynchronously rest, etc.). But in short:
look in the direction of gulp, bundling and minification of css and not separation.
So I want to combine into one file, but there are so many unused or duplicate classes... so I want as it remove the excess - Pablo63 commented on June 3rd 19 at 19:49
it is very difficult to be 100% to separate the wheat from the chaff. But where there is "unused"? By the way gulp (not himself of course) "duplicate" will not repeat. - hailee commented on June 3rd 19 at 19:52
Downloaded bootstrap template, made it fully already, and many classes in css no longer needed. Well, plus mounts your yii bootstrap.css and many classes in style.css and others .css from this template contain classes from bootstrap.css.

C gulp not yet encountered... Sit tinkered.
And briefly can you explain what it is for? And what will help in this situation? - Pablo63 commented on June 3rd 19 at 19:55

Find more questions by tags CSS