node-sass-middleware icon indicating copy to clipboard operation
node-sass-middleware copied to clipboard

Writing to response changes the path

Open AxelMontini opened this issue 6 years ago • 1 comments

I'm using these settings (version 0.11.0)

app.use(
    sassMiddleware({
      src: path.resolve(path.join(__dirname, '..', 'assets', 'sass')),
      dest: path.resolve(path.join(__dirname, '..', 'public', 'css')),
      debug: false,
      indentedSyntax: true,
      force: false,
      response: false,
    })
);

And my compiled CSS is available under the path /css/style.css.

When I change response to true, I get a 404 error and instead my CSS becomes available at /style.css.

Path change when modifying this option is not documented anywhere, so it is indeed unwanted.

File structure:

├── assets
│   └── sass
│       └── style.sass
├── package.json
├── package-lock.json
└── src
    ├── ...
    └── server.js

AxelMontini avatar Feb 15 '19 13:02 AxelMontini

I do have this aswell. I come around this by deactivating compiling on live server, then linking only compiled css. While in develop, I force compilation and then link two styles in my <head>

compiled css after "first" request <link rel="stylesheet" href="/custom.css"> actual compiled css <link rel="stylesheet" href="/static/compiled/custom.css">

fschoenfeldt avatar Apr 18 '19 12:04 fschoenfeldt