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

Improve source mapping compiler log message #163

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

esasse
Copy link
Contributor

@esasse esasse commented Nov 7, 2023

Improves previous PR #145.

Now the logical_path is properly logged, making it easier to find the problem.

Comment on lines 9 to 10
@logical_path = logical_path
input.gsub(SOURCE_MAPPING_PATTERN) { source_mapping_url(asset_path($2), $1, $3) }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not much of a fan of setting instance variables in the middle of methods to avoid passing them forward. Specially because the other two methods that use it still need other variables passed as parameters. Better to repeat logical_path here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I made the changes you asked. But I'd like to clarify why I decided on the previous path: logical_path is used in all methods of the class, so it's usually recommended to store it in an instance variable so that you don't need to pass it as parameters everywhere. And more parameters usually also make code harder to read.

@esasse
Copy link
Contributor Author

esasse commented Dec 8, 2023

@brenogazzola any other changes you want me to do so that this PR can be merged?

@brenogazzola brenogazzola merged commit 3611afa into rails:main Dec 11, 2023
4 checks passed
@brenogazzola
Copy link
Collaborator

Thanks, sorry for the delay!

dhh pushed a commit that referenced this pull request May 15, 2024
@esasse esasse deleted the sourcemap-logmessage branch May 21, 2024 13:17
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.

2 participants