Optimizing JS and CSS

Yes.

Got few suggestions.

1 Like

I am busy coding a new CP for the site in Vue so no time for side optimization projects at this time, Akshay.

However, when I'm finished with development, I'll certainly minimize all the JS and CSS as it makes sense.

You are right, of course; but it's not a priority at this time and I'm already too busy coding few features.

Thanks anyway!

1 Like

Hey Akshay,

To follow up:

If you are OK and have time, I'll ask you to help me optimize after I have the new Vue.js-based UserCP up and running (out of the mockup and into the real-world usage). I have at least 80 hours of full-stack development work, I estimate, to get the this new CP to where I want it to be. If I work on this 4 hours a day, that is 20 days of work; so obviously I have a lot to do, and that's just a very rough estimate without taking pencil to paper.

As mentioned, I need to stay focused on the new CP build at this time and am not too worried about shaving milliseconds here and there off the site loading before caching. That is something good to do together, later this year. OK?

1 Like

Sure, will use google closure compiler for minifying scripts, for css we have rewrite uri (Rewrite file-relative URIs as root-relative) first then can combine. I am not sure, VB has inbuilt tool already. We can think of serviceworkers after minifying resources (off course possible without minifying resources, but simply more http requests to server ).

For caching resources you can refer html5-boilerplate
https://raw.githubusercontent.com/h5bp/html5-boilerplate/master/dist/.htaccess

1 Like

Hi Akshay,

First, let me say that I normally minimize CSS and Javascript using:

  • uglifyjs
  • uglifycss

and both seem to work fine.

Also, it's not really necessary, or even a good idea, to combine all JS files into one big JS minimize file for a number of reasons.

It is not good to "over optimize" and little really great comes of it, in my view.

Most sites like this are changing often and there is always a lot of Javascript code to write, modify, change and debug. Creating "mothers of all minimized Javascript files" make things "a nightmare" and it is better to smartly combine them, and that cannot be done by tool because we need to know that we are developing, where the issues are, what is changing, and what is static.

But anyway, I'm not focused on it and it is not on the site development critical path to worry about minimizing more JS and CSS. I have a lot more important functional code to write for the next month or so.

Cheers and Thanks!

I usually combine and minify them dynamically based on filetime, no issue even if you modify or change code it will work.

  • create md5 hash of file to be combined and minified based on filetime.
  • check filename with above generated hash exists.
  • if exists just readfile otherwise combine and minify them and then serve to client.

One more probably you missed, "Toggle Forum Collapse" button plus symbol not changing when its expanded.

Thanks Akshay,

Honestly, I know how to minimize, combine and deploy Javascript and CSS :slight_smile:

I deploy CSS and JS daily.

What is important is writing code.

No one has complained in the last year (not a single person) that unix.com was "slow to load"... and I live and work 12 time zones away from the server and it loads very fast for me.

So, we all spend time on what is important and if I had nothing better to do, I would minimize more code.

Believe me, I have way too much to do to worry about something that is NOT a problem today and into 2019.

Cheers.

1 Like

:slight_smile:

1 Like

Cheers,

When I get finished with this "major" UserCP renovation project, if I have time, we can work on optimizing some JS and CSS to shave a few ms off the load time. Since I'm the only coder developing for the site; I have to prioritize tasks and projects.

Thanks again for your idea about optimizing JS and CSS, Akshay!

Great to see you here again. Hope you will be active and be a part of the team again!

1 Like