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

Introduce suspenders:styles generator #1145

Merged

Conversation

stevepolitodesign
Copy link
Contributor

@stevepolitodesign stevepolitodesign commented Nov 22, 2023

Configures applications to use PostCSS or Tailwind via
cssbundling-rails. Defaults to PostCSS with modern-normalize, with
the option to override via --css=tailwind. These options were pulled from the
supported list of options in Rails.

Also creates additional stylesheets if using PostCSS.

We choose to use cssbundling-rails instead of dartsass-rails or
tailwindcss-rails (or even just css) because we want to rely on Node to
process the CSS. Although we could have chosen to avoid using Node altogether,
we feel it's better to support it since we'll need it for additional generators,
like StyleLintGenerator, and to support modern-normalize.

Updates within_api_only_app by allowing support to conditionally comment out
the api configuration. This provided and opportunity to clean up existing setup
steps.

@stevepolitodesign stevepolitodesign changed the base branch from main to suspenders-3-0-0 November 22, 2023 11:04
@stevepolitodesign stevepolitodesign mentioned this pull request Nov 22, 2023
17 tasks
@stevepolitodesign stevepolitodesign force-pushed the suspenders-3-0-0-styles-generator branch 6 times, most recently from 6ab64e8 to 3721e61 Compare November 28, 2023 18:57
@stevepolitodesign stevepolitodesign marked this pull request as ready for review November 28, 2023 18:58
@stevepolitodesign stevepolitodesign force-pushed the suspenders-3-0-0-styles-generator branch 7 times, most recently from 02446f2 to 4a0bcbb Compare November 28, 2023 21:53
Configures applications to use [PostCSS][1] or [Tailwind][2] via
[cssbundling-rails][3]. Defaults to `PostCSS` with
[modern-normalize][8], with the option to override via `--css=tailwind`.
These options were pulled from the [supported list of options][4] in
Rails.

Also creates additional stylesheets if using PostCSS.

We choose to use [cssbundling-rails][4] instead of [dartsass-rails][5]
or [tailwindcss-rails][6] (or even just css) because we want to rely on
Node to process the CSS. Although we could have chosen to avoid using
Node altogether, we feel it's better to support it since we'll need it
for additional generators, like [StyleLintGenerator][7], and to support
[modern-normalize][8].

Updates `within_api_only_app` by allowing support to conditionally
comment out the api configuration. This provided and opportunity to
clean up existing setup steps.

[1]: https://postcss.org
[2]: https://tailwindcss.com
[3]: https://github.com/rails/cssbundling-rails
[4]: https://github.com/rails/rails/blob/438cad462638b02210fc48b700c29dcd0428a8b7/railties/lib/rails/generators/app_base.rb#L22
[5]: https://github.com/rails/dartsass-rails
[6]: https://github.com/rails/tailwindcss-rails
[7]: https://github.com/thoughtbot/suspenders/blob/main/lib/suspenders/generators/stylelint_generator.rb
[8]: https://github.com/sindresorhus/modern-normalize
[9]: https://tailwindcss.com/docs/functions-and-directives#layer
@stevepolitodesign stevepolitodesign merged commit 1a03e95 into suspenders-3-0-0 Nov 28, 2023
2 checks passed
stevepolitodesign added a commit that referenced this pull request Nov 28, 2023
These modifications were not captured before merging the #1145,
presumably because of an issue with GitHub CLI.
stevepolitodesign added a commit that referenced this pull request Nov 28, 2023
These modifications were not captured before merging the #1145,
presumably because of an issue with GitHub CLI.
stevepolitodesign added a commit that referenced this pull request Nov 28, 2023
These modifications were not captured before merging the #1145,
presumably because of an issue with GitHub CLI.
stevepolitodesign added a commit that referenced this pull request Nov 28, 2023
These modifications were not captured before merging the #1145,
presumably because of an issue with GitHub CLI.
stevepolitodesign added a commit that referenced this pull request Dec 11, 2023
In #1148 we introduce `stylelint`. However, the empty styles introduced
in #1145 are empty file violations. By adding comments, we avoid that
error.

Note that we need to add these comments because there's no way to
automatically fix those violations with something like `prettier`.
stevepolitodesign added a commit that referenced this pull request Dec 11, 2023
In #1148 we introduce `stylelint`. However, the empty styles introduced
in #1145 are empty file violations. By adding comments, we avoid that
error.

Note that we need to add these comments because there's no way to
automatically fix those violations with something like `prettier`.
stevepolitodesign added a commit that referenced this pull request Dec 11, 2023
In #1148 we introduce `stylelint`. However, the empty style sheets introduced in
#1145 are empty file violations. By adding comments, we avoid that error.

Note that we need to add these comments because there's no way to
automatically fix those violations with something like `prettier`.
stevepolitodesign added a commit that referenced this pull request Mar 22, 2024
Follow-up to #1145 and #1148

We decided it's best to limit the decisions a consumer needs to make.
Even though we defaulted to PostCSS, providing an option to override
this value felt like it went against the Suspenders ethos.

Additionally, the current version of Suspenders uses PostCSS, so this
change aligns with current behavior.

Also removes linting rules around Tailwind.
stevepolitodesign added a commit that referenced this pull request Mar 22, 2024
Follow-up to #1145 and #1148

We decided it's best to limit the decisions a consumer needs to make.
Even though we defaulted to PostCSS, providing an option to override
this value felt like it went against the Suspenders ethos.

Additionally, the current version of Suspenders uses PostCSS, so this
change aligns with current behavior.

Also removes linting rules around Tailwind.
stevepolitodesign added a commit that referenced this pull request Mar 22, 2024
Follow-up to #1145 and #1148

We decided it's best to limit the decisions a consumer needs to make.
Even though we defaulted to PostCSS, providing an option to override
this value felt like it went against the Suspenders ethos.

Additionally, the current version of Suspenders uses PostCSS, so this
change aligns with current behavior.

Also removes linting rules around Tailwind.
stevepolitodesign added a commit that referenced this pull request Mar 22, 2024
Follow-up to #1148 and #1145

In #1148 and #1145, we introduce the need for yarn to manage
dependencies. Those commits failed to establish a `.node-version` file,
which [normally would be generated][1] by Rails if **not** using
`import-maps`.

This commit introduces that file, which compliments the existing
`.ruby-version` file that is generated.

I chose to use `.node-version` and not `.nvm` or `.tool-versions` to
keep parity with Rails.

The [current version][2] set by Rails is `18.15.0`, but a [future
commit][3] aims to use the latest LTS value. This commit aims to use
that version.

This commit will also benefit a future `suspenders:ci` generator, since
the `.node-version` file will be used in CI.

[1]: rails/rails#51393
[2]: https://github.com/rails/rails/blob/e8638c9a942e94f097dc8f37a3b58ac067a5ca16/railties/lib/rails/generators/app_base.rb#L18
[3]: rails/rails#51393
stevepolitodesign added a commit that referenced this pull request Mar 22, 2024
Follow-up to #1148 and #1145

In #1148 and #1145, we introduce the need for yarn to manage
dependencies. Those commits failed to establish a `.node-version` file,
which [normally would be generated][1] by Rails if **not** using
`import-maps`.

This commit introduces that file, which compliments the existing
`.ruby-version` file that is generated.

I chose to use `.node-version` and not `.nvm` or `.tool-versions` to
keep parity with Rails.

The [current version][2] set by Rails is `18.15.0`, but a [future
commit][3] aims to use the latest LTS value. This commit aims to use
that version.

This commit will also benefit a future `suspenders:ci` generator, since
the `.node-version` file will be used in CI.

[1]: https://github.com/rails/rails/blob/68b20b6513fe56ca80e4966628c231b4d6113bea/railties/lib/rails/generators/rails/app/app_generator.rb#L57-L59
[2]: https://github.com/rails/rails/blob/e8638c9a942e94f097dc8f37a3b58ac067a5ca16/railties/lib/rails/generators/app_base.rb#L18
[3]: rails/rails#51393
stevepolitodesign added a commit that referenced this pull request Mar 22, 2024
Follow-up to #1148 and #1145

In #1148 and #1145, we introduce the need for yarn to manage
dependencies. Those commits failed to establish a `.node-version` file,
which [normally would be generated][1] by Rails if **not** using
`import-maps`.

This commit introduces that file, which compliments the existing
`.ruby-version` file that is generated.

I chose to use `.node-version` and not `.nvm` or `.tool-versions` to
keep parity with Rails.

The [current version][2] set by Rails is `18.15.0`, but a [future
commit][3] aims to use the latest LTS value. This commit aims to use
that version.

This commit will also benefit a future `suspenders:ci` generator, since
the `.node-version` file will be used in CI.

[1]: https://github.com/rails/rails/blob/68b20b6513fe56ca80e4966628c231b4d6113bea/railties/lib/rails/generators/rails/app/app_generator.rb#L57-L59
[2]: https://github.com/rails/rails/blob/e8638c9a942e94f097dc8f37a3b58ac067a5ca16/railties/lib/rails/generators/app_base.rb#L18
[3]: rails/rails#51393
stevepolitodesign added a commit that referenced this pull request Mar 22, 2024
Follow-up to #1148 and #1145

In #1148 and #1145, we introduce the need for yarn to manage
dependencies. Those commits failed to establish a `.node-version` file,
which [normally would be generated][1] by Rails if **not** using
`import-maps`.

This commit introduces that file, which compliments the existing
`.ruby-version` file that is generated.

I chose to use `.node-version` and not `.nvm` or `.tool-versions` to
keep parity with Rails.

The [current version][2] set by Rails is `18.15.0`, but a [future
commit][3] aims to use the latest LTS value. This commit aims to use
that version.

This commit will also benefit a future `suspenders:ci` generator, since
the `.node-version` file will be used in CI.

[1]: https://github.com/rails/rails/blob/68b20b6513fe56ca80e4966628c231b4d6113bea/railties/lib/rails/generators/rails/app/app_generator.rb#L57-L59
[2]: https://github.com/rails/rails/blob/e8638c9a942e94f097dc8f37a3b58ac067a5ca16/railties/lib/rails/generators/app_base.rb#L18
[3]: rails/rails#51393
stevepolitodesign added a commit that referenced this pull request May 10, 2024
Configures applications to use [PostCSS][1] or [Tailwind][2] via
[cssbundling-rails][3]. Defaults to `PostCSS` with
[modern-normalize][8], with the option to override via `--css=tailwind`.
These options were pulled from the [supported list of options][4] in
Rails.

Also creates additional stylesheets if using PostCSS.

We choose to use [cssbundling-rails][4] instead of [dartsass-rails][5]
or [tailwindcss-rails][6] (or even just css) because we want to rely on
Node to process the CSS. Although we could have chosen to avoid using
Node altogether, we feel it's better to support it since we'll need it
for additional generators, like [StyleLintGenerator][7], and to support
[modern-normalize][8].

Updates `within_api_only_app` by allowing support to conditionally
comment out the api configuration. This provided and opportunity to
clean up existing setup steps.

[1]: https://postcss.org
[2]: https://tailwindcss.com
[3]: https://github.com/rails/cssbundling-rails
[4]: https://github.com/rails/rails/blob/438cad462638b02210fc48b700c29dcd0428a8b7/railties/lib/rails/generators/app_base.rb#L22
[5]: https://github.com/rails/dartsass-rails
[6]: https://github.com/rails/tailwindcss-rails
[7]: https://github.com/thoughtbot/suspenders/blob/main/lib/suspenders/generators/stylelint_generator.rb
[8]: https://github.com/sindresorhus/modern-normalize
[9]: https://tailwindcss.com/docs/functions-and-directives#layer
stevepolitodesign added a commit that referenced this pull request May 10, 2024
These modifications were not captured before merging the #1145,
presumably because of an issue with GitHub CLI.
stevepolitodesign added a commit that referenced this pull request May 10, 2024
In #1148 we introduce `stylelint`. However, the empty style sheets introduced in
#1145 are empty file violations. By adding comments, we avoid that error.

Note that we need to add these comments because there's no way to
automatically fix those violations with something like `prettier`.
stevepolitodesign added a commit that referenced this pull request May 10, 2024
Follow-up to #1145 and #1148

We decided it's best to limit the decisions a consumer needs to make.
Even though we defaulted to PostCSS, providing an option to override
this value felt like it went against the Suspenders ethos.

Additionally, the current version of Suspenders uses PostCSS, so this
change aligns with current behavior.

Also removes linting rules around Tailwind.
stevepolitodesign added a commit that referenced this pull request May 10, 2024
Follow-up to #1148 and #1145

In #1148 and #1145, we introduce the need for yarn to manage
dependencies. Those commits failed to establish a `.node-version` file,
which [normally would be generated][1] by Rails if **not** using
`import-maps`.

This commit introduces that file, which compliments the existing
`.ruby-version` file that is generated.

I chose to use `.node-version` and not `.nvm` or `.tool-versions` to
keep parity with Rails.

The [current version][2] set by Rails is `18.15.0`, but a [future
commit][3] aims to use the latest LTS value. This commit aims to use
that version.

This commit will also benefit a future `suspenders:ci` generator, since
the `.node-version` file will be used in CI.

[1]: https://github.com/rails/rails/blob/68b20b6513fe56ca80e4966628c231b4d6113bea/railties/lib/rails/generators/rails/app/app_generator.rb#L57-L59
[2]: https://github.com/rails/rails/blob/e8638c9a942e94f097dc8f37a3b58ac067a5ca16/railties/lib/rails/generators/app_base.rb#L18
[3]: rails/rails#51393
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.

1 participant