Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8065505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:41:04+00:00 2026-06-05T11:41:04+00:00

I tried modules ‘less’ and ‘less-middleware’. I tried all the different code-snipplets I have

  • 0

I tried modules ‘less’ and ‘less-middleware’. I tried all the different code-snipplets I have found in all the tutorials. There is no documentation available. Can someone please explain how to configue Express.js and Less, so that less is getting precompiled properly?!

Use the following questions as a guideline:

  1. Shall you use either the ‘less’ module or the ‘less-middleware’ module? What is the official/supported way? What is superior?
  2. How should your directory-structure in /public look like? (any specific folders you need? ‘styles’/’less’/’css’? or is it up to yourself?)
  3. How to configure your express app regarding your directory-structure (from question 2). (static files and compiler options or less-middleware, what directories are important here)
  4. How to reference my precompiled stylesheet from the html? (with .less or .css? what reference type? What directory-path?)

Would be so nice if someone could answer that 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:41:08+00:00Added an answer on June 5, 2026 at 11:41 am

    This solution does only work for express 2.x.

    I have found a solution, this hopefully helps someone:


    1. less or less-middleware

    I am using less because I have read it is the official port. But not sure what the difference is since there is no documentation available.

    2. directory structure:

    Your directory structure doesn’t matter for less. But it is highly recommended to have a public folder that serves all the static content like JavaScript, , Less, CSS or Image files.

    3. App config:

    You need two specific things to make less working properly:

    First, the compiler, that compiles the less files:

        app.use(express.compiler({ src : __dirname + '/public', enable: ['less']}));
    

    And second, show express where to find the static files!

        app.use(express.static(__dirname + '/public'));
    

    Both should point to your public folder!

    4. The html

        <link rel="stylesheet" href="/styles/bootstrap.css">
    

    Point directly to your root-less file, that lies somewhere in your public folder.

    5. The Less Files

    Thanks to this answer I know what went wrong all the time. There is kind of a bug in less.js. It will not find all the less files that you import in your root file. So you have to add the correct path to every import!!!

    Replace
    @import "reset.less";
    with
    @import "/public/styles/reset.less";
    for every import you have!

    et voilà… 🙂


    Thank’s to everyone who helped with this issue. Also have a look at Wes Johnson’s answere. I think he has a very nice solution that somehow didn’t work for me…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've tried all manner of Python modules and they either escape too much or
I want set different access for different modules. I tried out $this->allow($role, $module, $controller,
I have a number of modules in CVS with different tags. How would I
I have some modules in an array. All the modules define a method called
I tried lots of modules, seems like nothing works well. Do you have any
Couple of custom modules were not working. I disabled/deleted them and tried to enable/install
In reference to vbScript opens up excel but doesn't load macro/modules? Now I tried
I have tried : c(module_name). : but this only works from the shell, and
I tried to adapt existing code and am not sure where everything should go.
I have added two modules in my drupal site called.... 1. me alias 2.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.