Optimizing JS and CSS


 
Thread Tools Search this Thread
Top Forums Web Development Optimizing JS and CSS
# 1  
Old 02-19-2019
Optimizing JS and CSS

Quote:
Originally Posted by Neo
Welcome Back Akshay!

Are you going to hang around for a while?
Yes.

Got few suggestions.
- How about minifying resources
- mod_expires
- Service workers setup
Image
Optimizing JS and CSS-screenshotpng

Last edited by Akshay Hegde; 02-19-2019 at 02:35 AM..
This User Gave Thanks to Akshay Hegde For This Post:
# 2  
Old 02-19-2019
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!
This User Gave Thanks to Neo For This Post:
# 3  
Old 02-19-2019
Quote:
Originally Posted by Akshay Hegde
Yes.

Got few suggestions.
- How about minifying resources
- mod_expires
- Service workers setup
Image
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?
This User Gave Thanks to Neo For This Post:
# 4  
Old 02-19-2019
Quote:
Originally Posted by Neo
Welcome Back Akshay!

Are you going to hang around for a while?
Quote:
Originally Posted by Neo
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?
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/h5...dist/.htaccess
This User Gave Thanks to Akshay Hegde For This Post:
# 5  
Old 02-19-2019
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!
# 6  
Old 02-19-2019
Quote:
Originally Posted by Neo
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.

Last edited by Akshay Hegde; 02-19-2019 at 07:46 AM..
# 7  
Old 02-19-2019
Thanks Akshay,

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

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.
This User Gave Thanks to Neo For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. Web Development

CSS frameworks

I have been reading up on CSS frameworks, to see if it could be useful for an intranet that I am helping to build, but the true purpose does not become clear to me. What circumstances would the deployment of a CSS framework be useful in? What does a CSS framework do that a CMS template cannot do? (1 Reply)
Discussion started by: figaro
1 Replies

2. Web Development

HTML down, CSS help, ahhhh

I am having some problems. I have been able to learn HTML, but when I try and encode CSS, nothing happens, what is the major issue here. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>MY CSS</title> <style... (7 Replies)
Discussion started by: N-Training
7 Replies

3. Web Development

On Css

<html> <head> <style> div.box {width: 300px; height: 200px; padding: 30px; font: 46 pt times new roman;} </style> </head> <body> <div class="box" style=" filter": progid:DXImagetransform.Microsoft.Alpha (Opacity=100, FinishOpacity=0, Style=1, StartX=0, FinishX=0,... (0 Replies)
Discussion started by: N-Training
0 Replies

4. Shell Programming and Scripting

sed remove css comments

Is there a way that I can use sed to remove lines with css comments like this? /* comment */ (9 Replies)
Discussion started by: gravesit
9 Replies
Login or Register to Ask a Question