Blog

(B)logs & Inzichten

Praktische IT-kennis uit 20 jaar ervaring. Direct toepasbaar.

Terug naar blogs
Artikel

Add Less to IIS Express and Visual Studio projects

1 februari 2014
1 min

Add Less to IIS Express for all Visual Studio projects

I like .less alot, we use it in most of our webprojects. With the release of Visual Studio 2013 Update 1 a new feature has arrived. Full Less integration within VS, thats awesome.

To use Less in your project you can simply add the following lines to your Web.Config file:

<system.webServer>  
    <staticContent>
        <mimeMap fileExtension=".less" mimeType="text/css" />
    </staticContent>
</system.webServer> 

Add Less to every project by default

When you are like me, and use Less in almost all of your projects and use IIS Express to run your webprojects and don't want to add the lines to your Web.Config all the time. You can add it to your default IIS Express configuration, like so:

  1. Navigate to C:\Users\username\Documents\IISExpress\config
  2. Open applicationhost.config with Visual Studio or your favorite text-editor.
  3. Search for the word mimeMap, you should find lots of 'em.
  4. Add the following line to the top of the list: <mimeMap fileExtension=".less" mimeType="text/css" />.

The result should be something like this:

<staticContent lockAttributes="isDocFooterFileName">
    <mimeMap fileExtension=".less" mimeType="text/css" />
    <mimeMap fileExtension=".323" mimeType="text/h323" />
    <mimeMap fileExtension=".3g2" mimeType="video/3gpp2" />
    <mimeMap fileExtension=".3gp2" mimeType="video/3gpp2" />
    <mimeMap fileExtension=".3gp" mimeType="video/3gpp" />
    <mimeMap fileExtension=".3gpp" mimeType="video/3gpp" />
    <mimeMap fileExtension=".aac" mimeType="audio/aac" />
    ...

Restart Visual Studio, delete the mimeMap from your Web.Config and you're setup!

Reacties