5 ms·
I design and write my company's framework, that other devs use to write websites and webapps. I base my work on existing technologies (lately Laravel, which me
by etatoby 10y ago
I design and write my company's framework, that other devs use to write websites and webapps.
I base my work on existing technologies (lately Laravel, which means Symfony, Gulp, and hundreds of other great libraries) but I always strive to:
1. Reduce the number of requests per page, ideally down to 1 combined and compressed CSS, 1 JS that contains all dependencies, 1 custom font with all the icons. Everything except HTML and AJAX should be cacheable forever and use versioned file naming.
2. Make the JS as optional as possible. I will go out of my way to make interface elements work with CSS only (including the button to slide the mobile menu, various kinds of tooltips, form widget styling, and so on.) Whenever something needs JS to work (such as picture cropping or JS popups) I'll make sure the website is usable and pretty, maybe with reduced functionality or a higher number of page loads, even if the JS fails to load or is turned off. Also, the single JS file should be loaded at the end of the body.
2b. As a corollary, the website should be usable and look good both when JS is turned off, and when it's turned on but still being loaded. This can be achieved with careful use of inline styles, short inline scripts, noscript tags, and so on.
3. Make the CSS dependency somewhat optional too. As a basic rule, the site should work in w3m, as pointed out above. Sections of HTML that make sense only when positioned by CSS should be placed at the end of the body.
I consider all of this common sense, but unfortunately not all devs seem to have the knowledge, skill, and/or time allowance to care for these things, because admittedly they only matter for < 1% of most website's viewers.
- HorizonShadow 10y agoI would say a lot of people disregard internet speeds when creating websites. Just check the source of any random website, and you're going to see jquery loaded, where it's either not being used at all, or using a single function in the entire library.
- NoGravitas 10y agoI think your 2, 2b, and 3 are absolutely spot on, and it is amazing the extent to which web developers go out of their way not to do these things. I'm going to slightly disagree with 1, though. It's somewhat important now, but should become less so as http2 gets more widely used.
- zelias 10y agoI don't completely agree. If you're working on an SPA that targets higher-income (e.g. better internet) consumers, a developer could be forgiven for doing as much as possible using JS. I choose to sacrifice the <1% of my target users who have JS turned off or have poor connections to benefit the UX of the other 99% of users. I think the time and resource investment in strictly adhering to these guidelines is cost-prohibitive for many lean engineering teams, particularly those at early-stage startups. I get that the web was designed to be optimized for HTML/CSS first, JS last. However, the web was also not originally designed to support web applications as complex as the marketplace currently supports. As the web matures as the only universal application platform (to compete with various native platforms), I think a paradigm shift is required -- towards replacing as much markup with programmatic code as possible. Such a paradigm shift is required for complex web applications to compete with native environments going forward. Of course, none of this applies if your organization just requires static websites. Choose the right tool for the job, and all that.