Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostCSS 8 support #31

Merged
merged 13 commits into from
Sep 25, 2020
Merged

PostCSS 8 support #31

merged 13 commits into from
Sep 25, 2020

Conversation

C-Lodder
Copy link
Owner

No description provided.

@C-Lodder
Copy link
Owner Author

C-Lodder commented Sep 19, 2020

@ai @XhmikosR Trying to add support for PostCSS 8.x here, but seem to be having issues with the source maps on Windows.
The tests run fine on Ubuntu as you can see from: https://github.com/C-Lodder/grunt-postcss/pull/31/checks?check_run_id=1137192879 however not locally.

Received:

'{"version":3,"sources":["../../test/fixtures/a.css"],"names":[],"mappings":"AAAA,EACI,UACJ","file":"..\\\\mapAnnotation Path.css","sourcesContent":["a {\\n    color: #fff;\\n}\\n"]}'
                                                                                                      ^^^

Expected:

'{"version":3,"sources":["../../test/fixtures/a.css"],"names":[ ],"mappings":"AAAA,EACI,UACJ","file":"../mapAnnotationPath.css","sourcesContent":["a {\\n    color: #fff;\\n}\\n"]}'

Do you have any idea what this could be?

@C-Lodder C-Lodder mentioned this pull request Sep 19, 2020
@C-Lodder C-Lodder mentioned this pull request Sep 19, 2020
3 tasks
@nDmitry
Copy link

nDmitry commented Sep 21, 2020

I don't think dropping support for all node versions except the current is the right move.
It should be in sync with PostCSS: https://github.com/postcss/postcss/blob/master/package.json#L6

@C-Lodder
Copy link
Owner Author

C-Lodder commented Sep 21, 2020

@nDmitry oops my bad. Updated the PR.

Still need to figure out why it's failing on Windows

@XhmikosR
Copy link
Collaborator

About the Windows issue, if you modify the sourcemaps here, make sure you don't use the generic path functions; instead use the path.posix variants.

@XhmikosR
Copy link
Collaborator

Since I'm on Windows, I'll have a look today. Sourcemaps can be tricky because the paths should always be Unix ones (not sure what the specs say, but this works everywhere AFAICT from all these years).

@XhmikosR
Copy link
Collaborator

XhmikosR commented Sep 21, 2020

This turns out to be tricky.

We should move with postcss 8.x and make a new issue about the Windows issue so that we try to fix it later.

EDIT:

Running "postcss:mapAnnotationPath" (postcss) task
>> File tmp/mapAnnotationPath.css created. 23 B → 68 B
>>>> result.map.toString(): {"version":3,"sources":["../../test/fixtures/a.css"],"names":[],"mappings":"AAAA,EACI,UACJ","file":"..\\mapAnnotationPath.css","sourcesContent":["a {\n    color: #fff;\n}\n"]}

>>>> result.map.toString().replace(/\/g,'/'): {"version":3,"sources":["../../test/fixtures/a.css"],"names":[],"mappings":"AAAA,EACI,UACJ","file":"..//mapAnnotationPath.css","sourcesContent":["a {/n    color: #fff;/n}/n"]}
>> File tmp/mapAnnotationPath.css.map created (source map).
1 processed stylesheet created. 23 B → 68 B
>> 1 sourcemap created.

The file property is still broken.

EDIT2:

Running "postcss:mapAnnotationPath" (postcss) task
>>> to: tmp/mapAnnotationPath.css
>>> path.dirname(to): tmp
>>> getSourcemapPath(to): tmp\maps\mapAnnotationPath.css.map
>>> path.relative(path.dirname(to), getSourcemapPath(to)).replace(/\/g, '/'): maps/mapAnnotationPath.css.map
>> File tmp/mapAnnotationPath.css created. 23 B → 68 B
>>>> result.map.toString(): {"version":3,"sources":["../../test/fixtures/a.css"],"names":[],"mappings":"AAAA,EACI,UACJ","file":"..\\mapAnnotationPath.css","sourcesContent":["a {\n    color: #fff;\n}\n"]}

>>>> result.map.toString().replace(/\/g,'/'): {"version":3,"sources":["../../test/fixtures/a.css"],"names":[],"mappings":"AAAA,EACI,UACJ","file":"..//mapAnnotationPath.css","sourcesContent":["a {/n    color: #fff;/n}/n"]}
>> File tmp/mapAnnotationPath.css.map created (source map).
1 processed stylesheet created. 23 B → 68 B
>> 1 sourcemap created.

@C-Lodder
Copy link
Owner Author

C-Lodder commented Sep 24, 2020

I've managed to find a fix in the postcss core. Will submit a PR and see what the author has to say

EDIT: didn't pass their tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants