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 9272793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:56:56+00:00 2026-06-18T15:56:56+00:00

I have my project and was porting some code over from express2.5.7 to express3.0.3.

  • 0

I have my project and was porting some code over from express2.5.7 to express3.0.3. I thought it was almost be a 1:1 transfer, but I’m running into an issue of not being able to compile my stylus files into the directory I specified. Here is my basic app.js setup:

/**
 * Module dependencies.
 */

var express = require('express')
  , routes = require('./routes')
  , user = require('./routes/user')
  , http = require('http')
  , path = require('path')
  , nib = require('nib')
  , bootstrap = require('bootstrap-stylus')
  , stylus = require('stylus');

var app = module.exports = express();

app.configure('dev', function(){
  var stylusMiddleware = stylus.middleware({
    src: __dirname + '/stylus/', // .styl files are located in `/stylus`
    dest: __dirname + '/public/css/', // .styl resources are compiled `/css/*.css`
    debug: true,
    compile: function(str, path) { // optional, but recommended
      console.log(path);
      return stylus(str)
        .set('filename', path)
        //.set('warn', true)
        .set('compress', true)
        .use(bootstrap())
    }
  });
  app.use(express.logger('dev'));
  app.use(stylusMiddleware);  
  app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); 
  app.set('view options', { pretty: true });
});

app.configure('prod', function(){
  app.use(express.errorHandler());
});

app.configure(function(){
  app.set('port', process.env.PORT || 3000);
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.use(express.favicon());
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(app.router);
  app.use(express.static(path.join(__dirname, 'public')));
});

app.get('/', routes.index);
app.get('/users', user.list);

http.createServer(app).listen(app.get('port'), function(){
  console.log("Express server listening on port " + app.get('port'));
});

I’ve tested the app.configure stuff and it is going through the correct methods (‘dev’ and the configure with just a function)

  • 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-18T15:56:57+00:00Added an answer on June 18, 2026 at 3:56 pm

    I try to set up custom src and dest too and I can’t. In search of solutions I looked into the Stylus source. In two words pathes to styl and to css files should be similar. If link to css file in html looks like

    <link rel="stylesheet" href="css/app.css">
    

    and Its physical path is

    public/css/app.css
    

    then your styl file should be located at

    stylus/css/app.styl
    

    and Express config should be

    app.configure('dev', function () {
      ...
      app.use(stylus.middleware({
        src: __dirname + '/stylus/',
        dest: __dirname + '/public/',
        compile: function(str, path) { ... }
      }));
      ...
    });
    

    What I saw in the source.

    Stylus parses all requests and selects only those that are requested css files. Then It combines css url’s pathname with your dest option, replaces css with styl in pathname and combines result with your src option:

    // Middleware
    return function stylus(req, res, next){
      if ('GET' != req.method && 'HEAD' != req.method) return next();
      var path = url.parse(req.url).pathname;
      if (/\.css$/.test(path)) {
        var cssPath = join(dest, path)
          , stylusPath = join(src, path.replace('.css', '.styl'));
    
        // ...
    
      } else {
        next();
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the process of porting a C project from Linux to Windows Have installed
I'm in the process of porting some code from Linux to Mac OS X.
I am porting a game over to a XNA 4.0 WP7 project but am
I have some C# code to add to an existing VB.net project. The C#
I have some code that is Java EE 5. I want to start porting
I have code that I am porting from iOS 4 to iOS 3.2 for
I have project Emle in Launchpad . I set it to import from emle.svn.sourceforge.net
I have project in Dropbox and two running laptops: one with Ubuntu and one
I am porting some Solaris code to Linux. This code uses the Solaris-specific door
I have ported a project using boost-build from Windows (using msvc) to Linux (using

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.