- Status: active
- Date: 2020-09-22
Most web browsers have good support for es6+ features while serving legacy/polyfills will increase and harm our user experience. According to our google analytics
| Browsers | Sessions |
Before diving into Long answer 👩🏫, let see why stylesheet's size is one of the most important factors in term of web experience.
In general, a stylesheet is just bunch of rules/selectors which can be defined in:
✍️ There are a lot of discussions for pros and cons of each approach and it's beyond the scope of this article, but if you are interested in you can read here.
According to wiki
Deadcode elimination is a compiler optimization to remove code which does not affect the program results.
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
sudo nano ~/.bash_profile
export PATH=/path/to/depot_tools:"$PATH"
(it's important that depot_tools comes first here)There are many ways to manage our state in frontend, but in my opinion (after debugging websites which use react), state can be classified into three categories:
I think best way to explain this concept is via example.
{ | |
"editor.tabSize": 2, | |
"editor.detectIndentation": true, | |
"editor.trimAutoWhitespace": true, | |
"files.trimTrailingWhitespace": true, | |
"terminal.integrated.copyOnSelection": true, | |
"explorer.confirmDelete": false, | |
"window.zoomLevel": 0, | |
"workbench.sideBar.location": "left", | |
"editor.minimap.enabled": false, |
assets = ['vendor.js', 'app.js']; | |
if (!("fetch" in window && "Promise" in window)) { | |
assets.unshift('polyfill.js'); | |
} | |
scripts.forEach(function(src) { | |
var scriptEl = document.createElement('script'); | |
scriptEl.src = src; | |
scriptEl.async = false; | |
document.head.appendChild(scriptEl); | |
}); |