Tôi đang cố gắng lấy phần mềm trung gian nút làm việc với Express. Ứng dụng chạy không có lỗinode-sass-middleware không biên dịch
...(modules)
var sassMiddleware = require('node-sass-middleware');
var routes = require('./routes/index');
var app = express();
// uncomment after placing your favicon in /public
//app.use(favicon(__dirname + '/public/favicon.ico'));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
//---- LOAD SASS -----//
// adding the sass middleware
var srcPath = __dirname + '/scss';
var destPath = __dirname + '/public/stylesheets';
app.use(sassMiddleware({
src: srcPath,
dest: destPath,
debug: true,
outputStyle: 'compressed'
}));
app.use(express.static(path.join(__dirname, 'public')));
Có thể thấy bất kỳ điều gì sai với cách tôi đang cố gắng biên dịch mẫu không?
cấu trúc file:
app
controllers
routes
public
-stylesheets
scss
...
Bạn đang sử dụng phiên bản Express nào? Ví dụ package.json họ đang sử dụng kết nối 2.7.9. Quy ước đã thay đổi rất nhiều vì vậy bạn có thể phải làm điều gì đó như app.use (sassMiddleware ({ src: srcPath, dest: destPath, gỡ lỗi: true, outputStyle: 'compressed' })()); – jusynth