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

  • SEARCH
  • Home
  • 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 8007857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:57:37+00:00 2026-06-04T17:57:37+00:00

After finally getting LESS-compiling into a Node.js app with express running on coffee, I

  • 0

After finally getting LESS-compiling into a Node.js app with express running on coffee, I ran into a problem where I seem to be running out of ideas:

Changes to the LESS-files will not invoke re-rendering from the LESS-compiler called by express.

In my main app.coffee file, this can be found (in that order)

app.use exp.compiler { src: __dirname + '/public', dest: __dirname + '/public', enable: ['less'] }
app.use exp.methodOverride()
app.use exp.bodyParser()
app.use exp.cookieParser()
app.use exp.static __dirname + '/public'

After that, session and middleware is added.

The problem with not recompiling .less files into .css when requested persists through app restarts.

I have tried swapping the exp.compiler and exp.static lines, but that changed nothing apart from what happens to the first client request (in short, css file is rendered but not delivered).

Deleting the .css file will obviously get the code to recompile the .less into .css, but that is not how I imagined a compiler like that. Is there anything else I can do?

  • 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-04T17:57:38+00:00Added an answer on June 4, 2026 at 5:57 pm
    // Environment Respective Less Watch Script
    if (app.settings.env === 'development') {
      var stylesheets = fs.readdirSync(path.join(__dirname, 'views', 'stylesheets')).filter(function(f) {
        return f.match(/\.less$/);
      });
      stylesheets.forEach(function(f) {
        fs.watchFile(path.join(__dirname, 'views', 'stylesheets', '/' + f), function(c, p) {
          if (c.mtime.getTime() !== p.mtime.getTime()) {
            // Remove the existing CSS file
            fs.unlinkSync(path.join(__dirname, 'public', 'stylesheets', 'bootstrap.css'));
            console.log(' Successfully removed existing stylesheet for recompiling');
          }
        });
      });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After 24 hours of trying to find the problem with my app. I finally
Now, finally after 12 years, when all the world is hopping into CSS3 media
After wasting some time to figure out what goes wrong, I finally have to
After finally getting the Android Facebook SDK to properly import thanks to this ,
After finally getting down to upgrading to FF 3.5, I noticed that some of
I'm finally getting started with version control after getting about 40% of the way
I am getting Index was out of range. Must be non-negative and less than
After getting counterclockwise working on my Eclipse setup and GAE development server running in
After going through tutorials on getting started with Tortoise I am finally starting to
Loooong time viewer, finally getting round to signing up here at StackOverflow! After a

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.