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

Update config.assets.debug documentation to reflect actual defaults [ci-skip] #51747 #51845

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

devikasugathan
Copy link

Motivation / Background

This Pull Request has been created because the Rails documentation currently states that config.assets.debug is enabled by default in the development environment. However, as of Rails 7.0 (commit adec7e7 on Aug 10, 2021), this setting is not included by default in the development.rb file. This discrepancy can lead to confusion for developers relying on outdated documentation. Updating this will provide clearer guidance and reflect the actual current behavior of Rails applications in development. Fixes #51747.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Unrelated changes should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

@rails-bot rails-bot bot added the docs label May 15, 2024
@devikasugathan
Copy link
Author

Fixes #51747

Comment on lines +665 to +674
In previous versions of Rails, `config.assets.debug` was set to `true` by default in the development environment, which disabled the concatenation and preprocessing of assets to facilitate easier debugging. This was particularly useful when working with a large number of complex assets, as it allowed developers to trace issues directly to specific files.

However, as of Rails 7.0 (commit adec7e7 on Aug 10, 2021), this setting is no longer included by default in the `development.rb` configuration. The change was made because the move towards using ECMAScript Modules (ESM) in development generally eliminates the need for concatenating or preprocessing large JavaScript files, rendering debug mode less relevant.

To explicitly enable or disable asset debugging in the current version of Rails, developers may add the following line to `config/environments/development.rb`:

```ruby
# Enable or disable asset concatenation and preprocessing for easier debugging
config.assets.debug = true # Set to `false` to enable concatenation and compression
```
Copy link
Member

Choose a reason for hiding this comment

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

@devikasugathan Thanks for the PR,

Actually we don't really need to mention the history of a configuration file. This document only refers what the purpose of config.assets.debug when it set to true.

also you can add following pattern which we are already using that for other configuration

The default value depends on the `config.load_defaults` target version:

| Starting with version | The default value is |
| --------------------- | -------------------- |
| (original)            | `true`               |
| 7.0                   | `false`              |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

config.assets.debug has misleading documentation
2 participants