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

Switch to dartsass-rails and foreman, ./bin/dev #1975

Merged
merged 10 commits into from
Apr 19, 2024
Merged

Conversation

nimmolo
Copy link
Contributor

@nimmolo nimmolo commented Feb 29, 2024

This is the standard SASS compiler people use. Our current gem dartsass-sprockets is sort of a retrofit that allows us to keep building assets with sprockets-rails. dartsass-rails seems to be better maintained though, and unlike dartsass-sprockets it has an option that silences our many Bootstrap-3-related SASS deprecation warnings in CI.

It builds assets using the gem foreman, which it automatically installs. Switching to this gem unblocks us from retiring sprockets and switching to propshaft if we want to.

Important

Developers need to change the way we start the local server

First, gem install foreman — devs must install locally, but I believe it will install automatically. The docs say it should not be bundled in the Gemfile, and explains why.

Then whenever you want to start the dev server, instead of rails s, you run ./bin/dev. That's it.

Explanation: ./bin/dev is a script that runs rails s and starts foreman. Unlike dartsass-sprockets, dartsass-rails does not automatically watch our assets/stylesheets folders for changes. The "watching" is performed by foreman.

Note

In our .github/ci_rails.yml, I've added this to build the Sass files before running any tests that interact with the browser:

bundle exec rails dartsass:build

It turns out though that foreman may be also useful for running a solid_queue server; specifically if it can stop and start the server on code changes. @mo-nathan and I are finding that solid queue is very finicky about changed code and requires a lot of restarting in dev. I believe we can add a proc to foreman's config so that it will restart solid queue. (We need to confirm that it can detect code changes that are relevant to solid queue, see this post.)

Our gem `sassc-rails` is not maintained and is not compatible with newer Bootstrap versions, which use newer Sass syntax.

TODO:
> In your continuous integration pipeline, before running any tests that interact with the browser, make sure to build the Sass files by running:
>
> ```
bundle exec rails dartsass:build
```
@nimmolo nimmolo changed the title Move SCSS compilation to gem dartsass-rails Update SCSS compilation to gem dartsass-rails Feb 29, 2024
@nimmolo nimmolo changed the title Update SCSS compilation to gem dartsass-rails Switch to dartsass-rails and foreman, bin/dev Mar 21, 2024
@nimmolo nimmolo closed this Mar 21, 2024
@nimmolo nimmolo reopened this Mar 22, 2024
@nimmolo nimmolo changed the title Switch to dartsass-rails and foreman, bin/dev Switch to dartsass-rails and foreman, ./bin/dev Apr 19, 2024
@coveralls
Copy link
Collaborator

coveralls commented Apr 19, 2024

Coverage Status

coverage: 94.335% (-0.05%) from 94.388%
when pulling 0bdf73e on nimmo-dartsass-rails
into 7c0ca66 on main.

@nimmolo nimmolo marked this pull request as ready for review April 19, 2024 02:54
@nimmolo
Copy link
Contributor Author

nimmolo commented Apr 19, 2024

@mo-nathan This may clear up the finicky solid queue situation in dev. We could try it either before or after the field slips PR.

In either case, we should add this to Procfile.dev before testing out how well it deals with starting SQ.

solidqueueworker: bundle exec rake solid_queue:start

@nimmolo nimmolo merged commit 7a986ee into main Apr 19, 2024
3 of 5 checks passed
nimmolo added a commit that referenced this pull request Apr 21, 2024
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.

None yet

2 participants