• .NET Developer Tools DevTools

    UI controls for ASP.NET AJAX, MVC, WPF,
    Silverlight, Windows 8 and Windows Phone

  • Hybrid Mobile Development Icenium

    Cross-platform Mobile Development Tool
    with cloud-based architecture

  • HTML5 / JavaScript Development Kendo UI

    Everything you need to build sites and
    mobile apps with JavaScript and HTML5

  • Testing Tools TestStudio

    One easy tool for Functional, Performance,
    Load and Mobile software testing

  • Web Presence Platform Sitefinity CMS

    Everything for your online business - content
    management, ecommerce, emarketing

  • Agile Project Management TeamPulse

    Simple and intuitive project management
    and collaboration software

Contact us

We are here for you.
  • usa+1‒888‒365‒2779
  • uk+44‒20‒7291‒0580
  • bg+359‒2‒8099850
  • de+49‒89‒2441642‒70
  • au+61‒2‒8090‒1465
  • emailsales@telerik.com
Your account Access to your products, updates and support
Telerik Product Families
  • Your Account
    Your Account
    Log in
  • ABOUT US

    About Telerik

    • Company
    • Press Center
    • Customers
    • Community
    • Careers
    • Contacts
Kendo UI - The way of HTML5
Products ▼
Kendo UI Web Kendo UI Mobile Kendo UI DataViz Server Side Wrappers
Demos Purchase Download
Blogs Documentation
Support ▼
Premium Forums StackOverflow Forums
Resources ▼

Featured Resource

Kendo UI Dojo


Blogs Code Library Demos Documentation FAQ Testing
Premium Forums Roadmap User Voice Videos Webinars More Resources
Contact Us Search
 

Blogs

Call to Action: Make LESS Native in Modern Browsers

Tuesday, May 01, 2012 by Kendo UI Team Blog | Comments 7

It’s no secret. I’m a LESS fan. A BIG fan.

If you’re not familiar with LESS, it’s an elegant CSS pre-processor that imbues the CSS syntax you already know with the kind of super powers you wish your styling language had out-of-the-box.

Variables. Operations. Hierarchal rules. Mix-ins.

LESS is all about making CSS more maintainable and reducing the kind of repetitive programming often required to maintain complex stylesheets. If you’ve ever caught yourself copying-and-pasting HEX color values, re-typing the CSS browser prefixes over and over and over, or crafting repetitive, long, chained selectors, then LESS is for you. It gives you the tools you need to organize these common pieces of CSS and reuse them throughout your stylesheet, all without forcing you to throw away everything you already know about CSS.

Sadly, though, LESS is a CSS pre-processor.

Browsers do not natively understand LESS. When you work with LESS, you must process it at some point, transforming the rich syntax in to vanilla CSS that any browser can understand. This pre-processing can happen at runtime (on the server or client) or (preferably for performance) at design/build time. Ultimately, it’s not usually a big deal to perform this processing step- part of the reason LESS is already awesome today- but it is a barrier to broad adoption.

Isn’t it time to enhance the power of the CSS language natively in browsers? Let’s break it down.

PROS: Making LESS Native

  • Remove barriers to LESS adoption. Anyone that wants to use LESS just deploys a LESS file (along with a fallback JavaScript pre-processor for older browsers). Using LESS becomes: <link type=”text/less” href=”styles.less” />.  Done.
  • Makes native LESS debugging in browsers possible. With LESS syntax preserved, it becomes possible to extend browser developer tools to natively work with LESS at runtime.
  • Reduces run-time performance concerns. Of course, you can avoid run-time perf problems today with a build-step pre-processor, but if you choose to do run-time processing (especially using JavaScript) there is a performance penalty. Putting the processing in the browser engine should make it fast to the point of being “instant.”
  • It’s not changing CSS! The beauty of LESS is that we’re just improving the language syntax- not its capabilities. Browsers don’t need to reinvent their CSS engines or adopt proprietary CSS features. They just need to give us more powerful language parsing.

And to be fair…

CONS: Making LESS Native

  • Two “styling” file types for the web. With the introduction of native LESS support, CSS support should not end. It should be a choice made by developers to deploy LESS or CSS. The added LESS file format could clutter the beautifully simple HTML, JavaScript, CSS trifecta we have today.
  • Legacy browser pain. Unless developers are careful to include the needed “fallback” pre-processing, older browsers would be presented with style-less (wha, wha….) pages.
  • Browsers doing too much? Do we want browsers doing more processing? Older JavaScript engines we’re painfully slow and constant sources of memory leaking. We definitely don’t want CSS to contribute similar problems.
  • Language complexity for designers. Believe it or not, this is probably one of the key blockers to native LESS support. I’ve been approached by multiple designers after doing LESS talks at conferences stating that LESS makes CSS too much like a programming language. And I guess at certain level, they’re right. Today, CSS is a very basic static styling language. What you type is what you get. Adding LESS does require runtime processing to see the final results.

So while there are some drawbacks to native LESS support, I think they can all be mitigated with minimal effort, especially since anyone (ahem…designers) that doesn’t want to use LESS can keep deploying “raw” CSS files.

Why LESS?

As much as I love it, LESS is not the only CSS pre-processor in town. There are other solutions that attempt to achieve similar results, of which the most popular alternative is definitely SASS. Where LESS tends to win in my book is in its elegant reuse of the CSS syntax you already know. It adds very little to the functional CSS operators and does not try to force “developer” constructs on CSS, like variable typing or verbose syntax.

The “new” variant of SASS, Sassy CSS (SCSS), tries very hard to be more LESS-like. It adopts the idea of naturally extending the CSS language rather than overhauling the syntax, but in my opinion it still feels more “developery” than LESS.

LESS is the perfect balance of power and elegance. It feels like a natural step for CSS, not a big jump.

The Past and Present

I’m not the first to think that browsers need to make CSS syntax more powerful and DRY. This argument has been raging for more than a decade. In fact, way back in 2008, Webkit nightlies briefly featured experimental support for CSS variables. Browser authors seem to recognize that enhancing CSS is necessary to evolve the productivity of developers (and designers), but so far most attempts have failed to come-up with a solution as elegant as LESS.

The specs for adding LESS-like features for CSS continue to be debated today. Unfortunately, all of today’s formal proposals are hopelessly focused on creating a language that feels more like JavaScript than CSS, and none have the proven popularity/adoption of something like LESS.

Sadly, the solution is staring the spec authors in the face.

Lobby Your Browser Authors

Here we go. My call to action.

Let’s help end the debate and steer browser authors towards a CSS enriching solution that has been proven in the market. Let’s help make the next step for CSS something that elegantly extends our working knowledge of CSS and doesn’t try to make CSS the next JavaScript. Let’s tell the browser authors we want to see native LESS support!

Until then…

With or without the browser authors, LESS is still great. Kendo UI will continue to use LESS under the covers to make more maintainable themes. In fact, if you use the Kendo UI ThemeBuilder, you can even get the LESS output for your own use/tweaking.

I will keep educating people about the benefits of LESS and maintaining resources like LessCssIsMore.com (a LESS playground/scratchpad).

Join the movement, won’t you? Do you want to see native LESS support in browsers? I’d love to hear your thoughts in the comments.

About the Author
Todd Anglin is an avid HTML5, CSS3, and JavaScript advocate, and geek about all things web development. He is an active speaker and author, helping developers around the world learn and adopt HTML5. Todd works for Telerik as VP of HTML5 Web & Mobile Tools, where his current technical focus is on Kendo UI. Todd is @toddanglin on Twitter.

7 Comments

  1. 1 James 01 May 2012
    I vote against this proposal.

    Given the difficulties we already have with browser compatibility, supporting older browsers, etc, I think that this approach generates a lot of extra work for not much benefit.

    Anybody that cares enough to use Less or SASS or some other CSS preprocessor already has some type of build script set up to automatically generate the final CSS for their site.

    I don't see any real benefits with this that outweigh the headaches involved. Just my opinion.
  2. 2 Ric 02 May 2012
    If I use a CSS preprocessor I prefer to do it on the server (or a build script). This it only gets processed once when first requested. The resulting file can then be cached, minified, gzipped or anything else. Why ask the browser to parse and create the CSS every time? I think people can be a little too obsessed with moving everything to the browser just because they can.
  3. 3 Stuart 02 May 2012
    I love the idea behind LESS and SASS and would equally love to see native support. Of the 2, I prefer LESS which is why I was disappointed to learn Telerik were using SASS.
  4. 4 Drew 03 May 2012
    I disagree as well. There is no standard for LESS; Vendor support will be a nightmare.
    I love using CSS pre-processors, but that's what they are: pre-processors. They're supposed to make my life easier. As it stands, LESS can be updated at will, with little concern towards backwards compatibility. If LESS gets a breaking update, guess what, none of my code breaks unless I update my LESS compiler. The CSS is untouched. If LESS was added to the browser, we wouldn't have any of that flexibility.
  5. 5 Morten 03 May 2012
    I used to be a big fan of LESS, until I used it for a major project and discovered how limited and broken its support for includes is. The generated output will literally explode in size and duplicated CSS rules.

    You're not mentioning Stylus, which is the newest CSS-fix-kid on the block. Looks to me like it'd be a much better thing to go for than LESS. See more at http://learnboost.github.com/stylus/ 

    Sadly, Stylus currently seems to only be available for use with Node.js.
  6. 6 Eric J. Smith 03 May 2012
    I think what we really need is to make all these pre-processors more 1st class citizens on the web platform.  Add source map support for javascript and css to all browsers.  Add an ability to register fallback mechanisms (JS processors) for browsers that don't natively support whatever pre-processor your code is trying to use.  If we had those two things, it would make things like LESS, SASS, CoffeeScript, Dart, etc all feel like 1st class citizens on the web platform and that would accelerate their adoption and encourage an ecosystem of competition between various pre-processors.
  7. 7 Eric J. Smith 03 May 2012
    Also, if we had the ability to register pre-processors for fallback mechanisms in our browsers, the browser could pass along information to the pre-processor like browser platform, browser version, feature capabilities, etc.  The browsers could also cache the result of the pre-processing so that the pre-processor wouldn't have to run over and over again when the source content hasn't changed.  Making pre-processors and source maps 1st class citizens would go a LONG way toward advancing the web platform in just a couple easy steps.

Comment

  1. Click to add

  2. Click to add

  3. Click to add

  4.    
     
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
     
      
       
Blogs feed
Categories

  • Tutorials (26)
  • Release (33)
  • Browsers (7)
  • Extensions (3)
  • Tip of the Week (10)
  • Videos (5)
  • Concepts and Theory (13)
  • Misc. (25)
  • Framework Constructs (6)
  • Mobile (6)
  • UI Widgets (5)
  • Blogs (1)
Archive
  • 2013 May (6)
  • 2013 April (10)
  • 2013 March (9)
  • 2013 February (12)
  • 2013 January (10)
  • 2012 December (9)
  • 2012 November (11)
  • 2012 October (6)
  • 2012 September (7)
  • 2012 August (8)
  • 2012 July (10)
  • 2012 June (8)
  • 2012 May (10)
  • 2012 April (7)
  • 2012 March (13)
  • 2012 February (10)
  • 2012 January (6)
  • 2011 December (10)
  • 2011 November (4)
  • 2011 October (6)
  • 2011 September (5)
  • 2011 August (9)
Home Web Mobile DataViz Server Wrappers Whitepapers Surveys Chrome Icenium Contact Us

Kendo UI framework is developed by Telerik - a leading provider of UI components for web, desktop and mobile applications. Trusted by over 100,000 customers worldwide for our devotion to quality and industry-best technical support, Telerik helps professionals maximize their productivity and "deliver more than expected" every day.

kendoui - powered by html5, css3 & jquery
get social
  • Twitter
  • Facebook
  • Google plus
  • RSS
Privacy Policy | Branding Guidelines
Powered by Sitefinity CMS

Copyright © 2011 - 2013 Telerik Inc. All rights reserved.