Skip to content

Remove default reliance on Sass and CSS generators #43110

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

Merged
merged 17 commits into from
Aug 26, 2021

Conversation

dhh
Copy link
Member

@dhh dhh commented Aug 26, 2021

Modern web applications are more likely than not to use a CSS framework like Tailwind, Bootstrap, or Bulma. Rails shouldn't be generating per-model stylesheets as though we were still writing everything by hand.

Also, Sass has chosen to focus exclusively on dart-sass, which requires all manner of dependencies that Rails won't adopt by default. So decrease our reliance on Sass, and move it to being an optional extra.

Co-authored-by: Kevin Newton <kddnewton@gmail.com>
@dhh dhh merged commit d5b9618 into main Aug 26, 2021
@dhh dhh deleted the remove-default-reliance-on-scss branch August 26, 2021 11:40
@jaredcwhite
Copy link

I'm all for taking sass out as a default, but putting Tailwind in as a suggestion is deeply concerning to me. There are numerous articles about the failings and problems regarding the philosophy of Tailwind and "utility class"-driven HTML markup…I wrote one of the most widely shared ones: https://dev.to/jaredcwhite/why-tailwind-isn-t-for-me-5c90

Perhaps the Gemfile could link to a Rails Guide that offers pointers to various CSS frameworks. At this PR stands, it appears that Rails is officially endorsing Tailwind. Yikes.

@dhh
Copy link
Member Author

dhh commented Aug 26, 2021

The Rails Doctrine is that the menu is omakase, not a buffet: https://rubyonrails.org/doctrine/#omakase. This means offering one default setting or suggestion, but allowing substitutions. A Rails Guide pointer that presents various CSS frameworks doesn't jive with that.

But yes, utility-style CSS is not everyone's flavor. Nor is Hotwire. Nor is minitest. Nor is even Active Record! Rails will continue to make it easy for those who don't like the defaults to change them, and continue to pick defaults for those who are happy to flow with an omakase menu ✌️

@jaredcwhite
Copy link

Thanks for the reply, and while I'm not thrilled with the outcome I appreciate the logic behind it. ✌️

@mgoggin
Copy link

mgoggin commented Aug 26, 2021

I love this direction (I'm a fan of Tailwind), but I'm concerned that this was merged into main without soliciting input from anyone, especially the Rails core team.

@kjellberg
Copy link
Contributor

Love it!

@glaucocustodio
Copy link
Contributor

Sad to see Sass not coming as default. The killer feature for me is nested syntax, it's a shame CSS still doesn't support it.

@brodock
Copy link

brodock commented Aug 29, 2021

sass is becoming hard to use due to bad maintainership. They keep deprecating their libraries and the substitution version is worst everytime. They could have kept maintaining ruby-sass they decided to not, then there was libsass which would bring most but not all functionality and that across many languages, then they again they decided to deprecate that and move yet to another ecosystem that no one really cares (dart).

@glaucocustodio
Copy link
Contributor

sass is becoming hard to use due to bad maintainership. They keep deprecating their libraries and the substitution version is worst everytime. They could have kept maintaining ruby-sass they decided to not, then there was libsass which would bring most but not all functionality and that across many languages, then they again they decided to deprecate that and move yet to another ecosystem that no one really cares (dart).

the dart saas compiles to javascript, so I don't see why not using it

@jrochkind
Copy link
Contributor

jrochkind commented Aug 30, 2021

The Rails Doctrine is that the menu is omakase, not a buffet: https://rubyonrails.org/doctrine/#omakase. This means offering one default setting or suggestion, but allowing substitutions.

Does this mean that Tailwind is becoming the Rails recommendation/supported option?

I hadn't noticed until now that there was a tailwindcss-rails project under the rails github org, so maybe so?

I do see that at least current version of this PR as I look at it now, will generate a Gemfile with (commented-out) options for both sassc-rails and tailwindcss-rails though? So maybe that suggests that in this case they are both equally preferred by Rails?

If there is a single Rails "omakase" choice, it would probably be good to make sure it's clearly documented/announced, as that tends to be the 'safest' choice to use with Rails -- as Rails core team generally does the work to make sure it keeps working, unlike other "non-omakase" options, which I guess is what "omakase" means for Rails actually.

(I use SASS, and probably won't stop, so hope it keeps working painlessly. But I don't use the per-model stylesheets and haven't in some time, so am quite content to see the generator code for those go. That is of course the bulk of this PR, and I haven't seen anyone say they'll miss that yet! The actual contents of the PR seem actually uncontroversial, people are just worried about possible increased pain to using SASS, since many use it and like it. The consequences of switching an "omakase" choice people have gotten used to are perhaps greater than the restaurant menu analogy, where you don't have to maintain or upgrade your past meals. :) ).

jonathanhefner added a commit to jonathanhefner/rails that referenced this pull request Feb 13, 2022
Since rails#43110, we no longer generate `.scss` files by default.

This commit:

* Changes remaining `.scss` filenames to `.css`.
* Updates the instructions for omitting the default Trix styles.
* Eliminates repetitive use of the word "default".
* Reorders the content slightly for better flow.
public-rant pushed a commit to opensource-rant/rails that referenced this pull request Feb 17, 2022
Since rails#43110, we no longer generate `.scss` files by default.

This commit:

* Changes remaining `.scss` filenames to `.css`.
* Updates the instructions for omitting the default Trix styles.
* Eliminates repetitive use of the word "default".
* Reorders the content slightly for better flow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants