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

OBS-383: Replace LESS with native CSS #6814

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

toufali
Copy link

@toufali toufali commented Nov 22, 2024

This PR transpiles LESS files to CSS – a preliminary step for the front-end refactor.

This PR is intentionally limited in scope for ease of review and logical/modular commits. Further changes to come, including deleting all LESS files, removing the LESS compiler and associated code.

These changes should not result in any visible difference in-browser. The app should still build without issue using django-pipeline. This was tested by following the steps in Production-style Assets, then spot-testing the site in the browser.

@toufali toufali requested a review from a team as a code owner November 22, 2024 04:21
@smarnach smarnach self-assigned this Nov 22, 2024
Copy link
Contributor

@smarnach smarnach left a comment

Choose a reason for hiding this comment

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

I'm somewhat out of my comfort zone here, so I'm not sure I understand correctly what's going on here.

It looks like this PR adds compiled versions of all the less files. And it looks like in the compiled versions all imports are inlined, and all variables are replaced with their actual values.

What I believe we eventually want is using CSS imports instead of the less imports, and CSS variables instead of the less variables, since this would keep the logical structure and maintainability of the code. Is this what you are trying to do? Or are you going some other route?

@toufali
Copy link
Author

toufali commented Nov 25, 2024

I'm somewhat out of my comfort zone here, so I'm not sure I understand correctly what's going on here.

It looks like this PR adds compiled versions of all the less files. And it looks like in the compiled versions all imports are inlined, and all variables are replaced with their actual values.

What I believe we eventually want is using CSS imports instead of the less imports,

Yes! Unfortunately CSS @import is not supported by django-pipeline. I plan to add that functionality after we install a new build tool to take django-pipeline's place. With the new tool (to come under separate PR), we should be able to fully utilize @import with tree-shaking and logical code maintainability. I left the soon-to-be obsolete LESS files in place as a temporary reference to the imports.

and CSS variables instead of the less variables,

Yes, ideally we would use CSS variables. However, the entire site style is ripe for a facelift. As I understand, the colors assigned to most/all variables are based on an obsolete "Photon" color palate. I'm happy to take a slight detour to replace all LESS vars with CSS vars, but I wonder if the app would be better served with a deeper look at style. Also, the LESS compiler doesn't offer automatic variable conversion, so the variable work would need to be manual.

In defining scope, I decided to focus more on build-tooling, architecture, dependencies, etc, leaving facelifts for future tasks. (Related, jQuery should be replaced too, but also probably out of scope for this first pass.) I intended this refactor to have a light touch on script/style, in order to confirm everything still works as expected with new tooling in place.

Happy to continue this discussion if you feel we should spend more time on CSS vars as condition for migration!

@willkg
Copy link
Contributor

willkg commented Nov 25, 2024

@smarnach I didn't realize you assigned this to yourself last week. Can you assign the review of this to me? I'm working with @toufali on this project and have a plan for validation already.

@smarnach smarnach assigned willkg and unassigned smarnach Nov 25, 2024
@smarnach
Copy link
Contributor

@willkg Sure, I didn't mean to interfere.

@toufali
Copy link
Author

toufali commented Nov 25, 2024

@smarnach I appreciated hearing your thoughts! Thanks for the look 😎

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