When I use the --sourcemap
argument in the CLI to generate the CSS builds with sourcemaps, when the CSS uses @include
, it does not update the path and therefore will not work.
In the code below, the builds are stored in the dist directory, while the CSS source code is stored in the src directory.
This is my simple code to reproduce this…
- src/
- stylesheet.css
- dist
- my-package.css
- my-package.css.map
- demo.html
- bundle.css
- package.json
bundle.css
@import 'src/stylesheet.css';
demo.html
<link rel="stylesheet" href="dist/my-package.css">
package.json
{
"name": "my-package",
"version": "1.0.0",
"license": "MIT",
"scripts": {
"build": "lightningcss --sourcemap bundle.css -o dist/my-package.css"
},
"devDependencies": {
"lightningcss-cli": "^1.25.1"
}
}
src/stylesheet.css
body {
background-color: red;
}
dist/my-package.css output
@import "src/stylesheet.css";
/*# sourceMappingURL=dist/my-package.css.map */
What I expected from the dist/my-package.css output
@import "../src/stylesheet.css";
/*# sourceMappingURL=dist/my-package.css.map */
Does anyone know why this is the outcome? Any help will be most appreciated.
You must log in or register to comment.