CSS isn't compiled after the first success?
See original GitHub issueI’m running into a weird issue using this middleware with Express. Here is our usage:
var sass = require('node-sass-middleware');
app.use('/css', sass({
src: __dirname + '/style/sass',
dest: __dirname + '/style/css',
outputStyle: 'nested',
debug: true,
force: true,
sourceMap: true
}));
Our issue is that if we don’t pass force: true
, the CSS for our source file only compiles successfully the first time, and 404s after that. I’ve cloned the repo and added a test case that attempts to simulate this by simply requesting a stylesheet twice in a row, but I can’t reproduce it.
Here’s what happens on the console:
-
The first request outputs the sass middleware’s debug messages, as expected:
source: /Users/allens/work/eiti-data/style/sass/main.scss dest: /Users/allens/work/eiti-data/style/css/main.css read: /Users/allens/work/eiti-data/style/css/main.css render: /Users/allens/work/eiti-data/style/sass/main.scss render: /Users/allens/work/eiti-data/style/css/main.css.map source: /Users/allens/work/eiti-data/style/sass/main.scss dest: /Users/allens/work/eiti-data/style/css/main.css
-
The second time around, nothing happens and Express returns a 404.
-
The third time around, the middleware outputs just the source and dest paths, but no render calls:
source: /Users/allens/work/eiti-data/style/sass/main.scss dest: /Users/allens/work/eiti-data/style/css/main.css
I can try to create a standalone test case for this if you’d like, but I just wanted to make sure that I’m not doing something glaringly wrong or missing something totally obvious. As you can see, there’s nothing very complex going on in our SCSS source. Thank you!
Issue Analytics
- State:
- Created 8 years ago
- Comments:14 (2 by maintainers)
Top GitHub Comments
@am11 That seems indeed to fix the issue, thanks!
I copied my original code from the Express example in the README, so I’ve created a PR (#89) to fix that example.
@torfsen, does it work if you replace:
with:
See a working example at: https://github.com/sass/node-sass-middleware/issues/70#issuecomment-261822665 and working project at https://github.com/sass/node-sass-middleware/issues/70#issuecomment-261835085.