Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Browser Link + LESS? Does it work?

DZone's Guide to

Browser Link + LESS? Does it work?

· Web Dev Zone
Free Resource

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

(You can grab the code for this from: https://github.com/rmaclean/BrowserLinkAndLESSDemo)

imageAt TechDays in Johannesburg, I showed a lot of cool stuff, but this post is about two specific pieces of awesome technology – Browser Link & LESS. In my talk (you can watch  a video of it here) I showed off how you use Browser Link with Web Essentials to detect unused CSS. A rather sharp attendee came up to me afterwards and asked me, what happens with LESS? Does it do the same thing?

I went back and experimented with it – first was to setup some CSS that wasn’t used and test. Everything works as expected.

Step two, was to use LESS directly, so I setup the HTML with

  • I used Nuget to pull down LESS.js
  • I put in the the link to the LESS file

<head runat="server"><br>
    <title></title><br>
    <link rel="stylesheet/less" type="text/css" href="/Content/Awesome.less" /><br>
    <script src="Scripts/less-1.4.2.min.js"></script><br>
</head>
Next step was to configure IIS Express, using the web.config, to serve the LESS file. To do that I added the following to the web.config file:
<system.webServer><br>
  <staticContent><br>
    <mimeMap fileExtension=".less" mimeType="text/css" /><br>
  </staticContent><br>
</system.webServer>

and I ran the app again. You know what happened? It all just worked – Browser Link’s CSS logic detected the unused class in the LESS file, and when I clicked it – it took me directly to the class in the LESS file Smile



Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.

Topics:

Published at DZone with permission of Robert Maclean, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}