Open Kristinita opened 2 years ago
I am observing this as well. PurgeCSS maps my scss definitions to Bootstrap files which I also include. For a while I was extremely confused while debugging until realizing that PurgeCSS is doing this. I am using PurgeCSS through Parcel/PostCSS.
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue is still relevant.
Thanks.
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Still relevant. Thanks.
I have not found a solution for this so far. But you can specify the path of the source file manually if needed with sourcemap.from
purgecss:
options:
content: ["KiraHTML.html"]
sourceMap:
from: "../stylus/KiraStyles.styl"
target:
files:
"css/KiraStyles.css": ["css/KiraStyles.css"]
@CxRes, do you have a repo with this issue I could look into by any chance?
I have, but I had removed the offending postcss config file (So, I am not using PurgeCSS). I will need to create a separate branch and reproduce the bug for that.
@Ffloriel Can I get back to you on this next week, I have a deadline for Saturday.
Sure no problem, thanks.
1. Summary
PurgeCSS generates incorrect paths for the value of
"sources"
source map key.In my MCVE PurgeCSS generates
instead of correct:
2. MCVE
I can’t reproduce the problem on PurgeCSS CLI, I get the error
error: unknown option '--sourceMap'
. Since no information about this option in the CLI documentation, it’s possible that it isn’t currently supported by the CLI. Therefore, Grunt in my MCVE.In my environment, I compile Stylus to CSS, and then apply PurgeCSS to my CSS.
You can see this MCVE configuration on the KiraPurgeCSSSourceMapPath folder of my GitHub repository for debugging and demonstration.
Gruntfile.coffee
:KiraHTML.html
:stylus/KiraStyles.css
:The part of the
.travis.yml
:3. Source map
3.1. Correct — Stylus
Stylus compiled this CSS file (Travis link):
Decoded base64:
../stylus/KiraStyles.styl
is the correct path to my Stylus file.3.2. Incorrect — PurgeCSS
PurgeCSS create this CSS file (Travis link):
Decoded base64:
stylus/KiraStyles.styl
is the incorrect path to Stylus file.I use merge-source-maps for merging separate source maps on each step of compilation. merge-source-maps throws an error due to an invalid value of
"sources"
field (Travis link):4. Environment
Operating system:
Node.js v18.9.0
grunt-cli v1.3.2, grunt v1.5.3
grunt-purgecss 5.0.0
grunt-contrib-stylus 1.2.0
merge-source-maps 0.6.1
Thanks.