Node.js - express - jade - compile SASS/LESS

前端 未结 5 1690
忘了有多久
忘了有多久 2021-01-31 12:21

Anyone have a really newbie guide to nodejs - express - SASS/LESS? I have not been able to get this working. The example I have now is a bareboned as possible..

5条回答
  •  我在风中等你
    2021-01-31 13:02

    I'm also a newb trying to get this setup. I have tried a few snippets I found until I finally noticed that express has an 'express' command that sets up a new project.

    Try express -c less to create a sample project with LESS as the CSS engine.

    This should create the required directories. The new css files will be served from your static directory.

    The configuration is:

    app.configure(function(){
      app.set('views', __dirname + '/views');
      app.set('view engine', 'hbs');
      app.use(express.bodyDecoder());
      app.use(express.methodOverride());
      app.use(express.compiler({ src: __dirname + '/public', enable: ['less'] }));
      app.use(app.router);
      app.use(express.staticProvider(__dirname + '/public'));
    });
    

提交回复
热议问题