Why do resource files need to be minified? [closed] - javascript

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I've been looking at ways to improve perfomance of my website. I've seen many people mentioning that it is good to minify files in production, which would improve speed as the amount of data that needs to be transferred would reduce. To my understanding, most modern browsers cache HTML, CSS and JS files. If that is the case, is there any additional benefit of minifying these files?

"To my understanding, most modern browsers cache HTML, CSS and JS files"
True, but cached resources are available only after the first visit. The first visit to your website will result in the client downloading all of these resources, and only then caching them, which could result in high response times for large files.
Resource file minification has no other real benifit besides reducing loading time.

Related

Store 2000 images [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I am implementing a web application which uses React as front end and Asp.net as backend. I have around 2000 images that has to be used in the web application. What will be best way to store these images ?
The best way is never store any media yourself.
Since serving any image/video content relies heavily on your network/bandwidth, it is not always stable and vulnerable to the slightest DDoS attack. Let alone that the security of your server may not be enough to protect your data.
I would highly recommend you to lookup some CDN, or Content Delivery Network, provider, such as AWS and GCD. You may also set up access right and serve criteria to better protect your data in these providers.
Reference:Why Use CDN’s for Your Website & Image Hosting
Edit: I just noticed that you have tagged your question with azure-storage, which is also a great option for serving media over the internet.

Do AMD apps load faster than CommonJS apps in the browser? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I have read quite a lot on those two subjects, but they still confuse me. From what I understand, AMD is generally a better choice for front-end applications, since it handles asynchronicity better. Does that mean that AMD applications are faster? Why are AMD modules better suited for browsers?
According to #Mike C, an application using AMD modules will load faster than an application using CommonJS modules, but the difference is in micro-milliseconds.

What's faster: anchoring or hide/show with JS? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm making a website for a client that will mostly be used offline through a wifi router. But there will also be an online version available. The purpose of this is to distribute files in parts of the world where infrastructure is not suitable for internet access. For those who do have internet access in some of these parts, the internet probably isn't very fast or reliable.
Some of the pages I've made can be accessed simply by using JS functions to hide one page and show another, instead of anchoring to another file. I figured this method might load content quicker, rather than linking to multiple pages. But is that true? Or should I just put all the content on separate pages?
Yes, that's true, but most browsers doesn't load a page if they don't get an answer, so you'll need at least one local server. You can store almost everything (style, script and content) in localstorage, store as strings and eval if/when needed. Also, if local processing isn't a problem you can use AngularJS to build and rebuild the page.

Concat or not to concat external scripts? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
My site uses a variety of JS scripts. With the ones that I write, I concat to one master JS file.
I have a number of external scripts for things like Pinterist sharing, or Google's places API.
Should these be downloaded and concatenated into my master JS file or should I leave them as a separate call to each of their APIs, as so:
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=places"></script>
I think concatination of external scripts is a BAD idea.
What about security fixes and updates? You would loose all of that. Many resources like Google etc get updated regularly, so you would have to check it, download it and concatinate. That is too much work for 'having one master JS file'.

JavaScript and Styles compression [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I understand the basic principles of script/style compression. What I would like to know is how do I integrate minified/combined scripts into my process and not interrupt my normal development flow?
I obviously want to use the regular files while developing then switch to the minified versions for deployment. I currently use YepNope to load my scripts. Is there some sort of conditional I could use to tell the browser to load the regular files?
Environment: VS 2010
My solution to this was to go with Microsoft's own Ajax Min its pretty nice. Compression is on par with some others I used.
As far as telling the browser to load minified versions or full, I added that into the post build script. Basically if you are in this particular environment then do not build the minified versions. Then in the js I have a little flag that points to one or the other depending on environment.
Hope this helps.

Categories