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

Do not recommend using globbing for Sass #2

Open
mcmire opened this issue Dec 8, 2016 · 0 comments
Open

Do not recommend using globbing for Sass #2

mcmire opened this issue Dec 8, 2016 · 0 comments

Comments

@mcmire
Copy link

mcmire commented Dec 8, 2016

In Rails projects, you may use the @import directive to import all files within a directory, like so:

@import "components/*";

In this case, the files will imported alphabetically. Because of the nature of CSS, this can lead to unexpected behavior where one file overrides the styles of another file simply because it comes later in alphabetical order.

For this reason, we need to discourage use of this and recommend explicitly listing files within a directory instead.

If you want to require all files in a directory, you can do so a little more elegantly by placing an _index.scss file in the directory, @importing all other files in that directory there, and then importing the index file in application.scss.

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

No branches or pull requests

1 participant