Is it possible to inline LESS stylesheets?

CssLess

Css Problem Overview


For example, is it possible to do something like:

<style type="text/less">
  #foo {
    .bar {
       font-weight: bold;
    }
  }
</style>

Css Solutions


Solution 1 - Css

You actually need to use

<style type="text/less">

instead of:

<style type="stylesheet/less">

Otherwise it won't work.

Remember to place the <style> element before the <script> element to load less.js.

Solution 2 - Css

This has been possible since July 2010, and it works with today's Less 1.2.0 version.

See the initial diff that added support for this.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDavid WoleverView Question on Stackoverflow
Solution 1 - CssOtto CosterView Answer on Stackoverflow
Solution 2 - CssDan CecileView Answer on Stackoverflow