skip to content rich footer

stevenclark.com.au

subscibe to the StevenClark.com.au rss feed

Archive for the 'usability' Category

CSS Preprocessing with JavaScript is a Bad Idea

Monday, June 21st, 2010

Dmitry Fadeyev posted an article titled Less.js Will Obsolete CSS a few days ago and I thought it worth mentioning in a post here. My short response is that I disagree with the idea of using JavaScript to pre-process Cascading Stylesheets (CSS).

As a web standardista, my first and foremost response is that best practice web standards methodology is to separate content (HTML) from presentation (CSS) from behaviour (JavaScript) in web design. Moving presentation (CSS) to the behaviour layer (JavaScript), which is the fundamental idea underlying Less.js, is therefore something that I would never recommend regardless of any accrued performance benefits.

The benefits accrued through separation of these three layers far outweigh any performance response available by downloading yet another JavaScript file.

Best practice web standards methodology also puts forward the concepts of progressive enhancement and graceful degradation. This means you either start with the idea of building a basic user experience and enhancing it for those who have better browsers… or you build better users experiences that degrade well for users who have lesser browsers.

The benefits accrued from those two concepts are vital to providing high quality professional experiences to end users of any website. I would call them a baseline. Yes you can do great and wonderful things as long as the intelligence is in-built to adapt to the unexpected – because the crux of the World Wide Web is that we have zero control over user’s hardware / software / settings.

Even if the argument that only 5 per cent (or 1 per cent) of web browsers had JavaScript disabled that would equate to many millions of people on the World Wide Web. Add to that percentage the still huge numbers of lower end mobile devices, particularly when you look at developing economies. So I’m far from sold on the idea that everybody has JavaScript enabled.

For example, 10-25 per cent of screenreaders are JavaScript disabled. [This statistic simply serves as an example that we can never strategically take 'JavaScript enabled' for granted in our work.]

I’ve probably got other more technical questions… but I needn’t go further within my rationale. This is a smart solution using the wrong tools based on unsound assumptions about user capabilities. I have enormous respect for Dmitry and his capabilities but on this one I have to disagree. Less.js isn’t a CSS obsoleter by a long margin.

The reason I am writing this article and stating my opinion (comments off) is that I think its an unhealthy mindset for other developers to emulate. We’ll just have to agree to disagree, I guess.

Update: 21 June, 2010
If I asked you this question then – would you build a JavaScript main navigation on a website assuming that everybody has JavaScript capabilities? Or a JavaScript shopping cart on your ecommerce website? I think we’re having the 2003 DHTML conversation again.

Social Networking

Keep an eye out for me on Twitter

About the Author

Steven Clark Steven Clark - the stand up guy on this site

My name is Steven Clark (aka nortypig) and my passions are business, web development, photography and writing. My current CV [PDF 775KB] is available for download. Currently I'm completing my 2 final units of a post-graduate university degree of MBA (Journalism and Media Studies) at the University of Tasmania.

Photography

My fine art photography is available online at Steven Clark Studio. You may also enjoy my photo blog Walk a Mile in my Shoes.

Recently Reviewed Books

Site Supporters

Hosted by Brett Drinkwater at Tashosting who is always there at the other end of my every inconvenient question and technical crisis. Brett's local community support for us over the last five years is greatly appreciated.

skip to top of page

Currently Reading

Light Science and Magic by Hunter, Biver and Fuqua - cover

The time has come for me to get more involved in upping my technical photography skills if I hope to embark on a Master of Fine Art and Design (Photography) next year. To that end my first book is the highly recommended Light Science & Magic: An Introduction to Photographic Lighting (Third Edition) by Fil Hunter, Steven Biver and Paul Fuqua. What really differentiates this book is the comprehensive set of exercises and the detailed explanation of the underlying science of light in the real world that encompasses the reader's journey.