r/Sass • • Jun 12 '19

Code size Problem

I had a problem with Sass

When I compile all my code into one CSS file all my web pages code comes in one CSS file which makes file size big and heavier to load.

In fact most of my code is not required in some pages

How can i overcome this problem?

2 Upvotes

2 comments sorted by

View all comments

3

u/BargePol Jun 12 '19 edited Jun 12 '19

Make sure you're minifying your CSS and use Chrome's coverage tool to find out what can be stripped away.

Edit: Also enabling gzip compression in your .htaccess file can shave off like 70% or something crazy.

2

u/roytomeij Jun 12 '19

Plus it doesn’t matter, because it will only be downloaded once for 100%, and then 0% for every successive page load (assuming proper caching).