Betterment / test_track

Server app for the TestTrack multi-platform split-testing and feature-gating system
MIT License
119 stars 33 forks source link

feat: replace vendored style_closet w/ Primer #184

Closed HipsterBrown closed 1 year ago

HipsterBrown commented 1 year ago

Summary

Fixes https://github.com/orgs/Betterment/projects/10?pane=issue&itemId=21046385

This PR is an exploration to replace the vendored style_closet gem with a documented, out of the box design system that integrates well with Rails.

Other Information

As part of this exploration, stylesheet processing is handed off to cssbundle-rails using dart-sass, replacing the sass-rails gem. This provides the latest Scss syntax and ability to pull in styles from npm, i.e. @primer/css and @primer/view-components.

With the adoption of ViewComponents and Primer, there is further optimization available to create components for existing abstractions, like the Info Card, and replace simple_form with a more accessible alternative like view_component-form.

I chose not to migrate the JS processing to jsbundling-rails since it was not required to adopt Primer or ViewComponent.

If this feels like too much to do in a single PR, it should be possible to take a more incremental approach by:

This branch can serve as a blueprint for what the final result might look like.

/domain @Betterment/test_track_core

Screenshots: Screenshot 2023-03-03 at 16-51-43 Split Details test_split_enabled Screenshot 2023-03-03 at 16-51-25 Split Details test_split_enabled Screenshot 2023-03-03 at 16-51-16 Split Details test_split_enabled Screenshot 2023-03-03 at 16-33-52 Test Track Admin Screenshot 2023-03-03 at 16-33-41 Test Track Admin

HipsterBrown commented 1 year ago

Thanks for the feedback! Related to the deployment question:

When you deploy your application to production, the css:build task attaches to the assets:precompile task to ensure that all your package dependencies from package.json have been installed via yarn, and then runs yarn build:css to process your stylesheet entrypoint, as it would in development. This output is then picked up by the asset pipeline, digested, and copied into public/assets, as any other asset pipeline file.

https://github.com/rails/cssbundling-rails#css-bundling-for-rails

It should "just work" 🤞