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

Sourcemap weirdness #180

Closed
ffoodd opened this issue Nov 23, 2020 · 7 comments
Closed

Sourcemap weirdness #180

ffoodd opened this issue Nov 23, 2020 · 7 comments

Comments

@ffoodd
Copy link

ffoodd commented Nov 23, 2020

Hi there!

I'm currently working on implementing RTL on Bootstrap v5, and while doing so I noticed that sourcemaps for RTLCSS processed files have some weirdness:

  1. a new source is mentionned, not part of our sources and not a file either;
  2. its path is URL encoded: %3Cinput%20css%202%3E (which results in <input css 2>);
  3. and AFAIK seems to be mapping to the /* rtl:raw */ directive.

So this is not really bug IMHO, however I think this should either be "customized" to mention something like "RTLCSS raw directive" or at least be mentionned somewhere in RTLCSS docs.

I'm not sure customizing sourcemaps in that case is doable, but would be really great 👍

Thanks for your invaluable work, I'd be pleased to have some review from you one day ❤️

@MohammadYounes
Copy link
Owner

Hi,

Thanks for such a Great PR, It's a joy to see rtlcss has finally made it to the official bootstrap 👍

Yes, indeed, parsing CSS strings without setting its input source produces such result. Do you think it's better to have it point to the original file instead of <input ...> ?

@ffoodd
Copy link
Author

ffoodd commented Dec 1, 2020

If possible, I guess it'd be better indeed.

I'm wondering what you mean by "without setting its input source": is there some way to set the input on our side?

@MohammadYounes
Copy link
Owner

This need to be changed inside the plugin. The source can be set in postcss parse options

const root = postcss.parse(css, { from: 'a.css' })
root.source.input.from //=> "/home/ai/a.css"

const root = postcss.parse(css)
root.source.input.from //=> "<input css 1>"

see https://postcss.org/api/#input-from

@MohammadYounes
Copy link
Owner

@ffoodd I made a quick fix, I would appreciate it if you update to v2.6.2 and let me know the result.

@ffoodd
Copy link
Author

ffoodd commented Dec 1, 2020

Nice, I need to check if it suits our need.

As I said, that's not a bug at all. Thanks for your help!

@ffoodd
Copy link
Author

ffoodd commented Dec 3, 2020

@MohammadYounes Thanks a lot, it's really better! We now have bootstrap.rtl.css as a source <3

@ffoodd ffoodd closed this as completed Dec 3, 2020
@blimmer
Copy link

blimmer commented Feb 25, 2022

For folks who find this issue trying to debug their application, here's the fix that was released in 2.6.2: 80c15f2

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

No branches or pull requests

3 participants