Files starting with an underscore at the beginning, what do they mean?

I just reviewed several projects developed by other people.

I think that everything is in order.

Programmers created several files starting with underscores, for example _variables.scss, which I saw in both projects.

I can’t understand why, also I have googled, and I can’t find the answer if there is a special reason why people name files this way.

Thanks!

+7
sass
source share
3 answers

In my opinion, the only reason to use the underscore in front of the partial name is because

  • The underline lets Sass know that the file is only a partial file and that it should not be generated in the CSS file. * "

Any SASS files that do not begin with an underscore will be displayed on their own, which will not work if they use variables or mixins defined elsewhere.

In conclusion, I came to the conclusion that the underscore is simply used to clarify that it is a partial file. We can also use a partial file without using underscore as a prefix.

+7
source share

Sometimes this naming convention is used for templates or template part files; you may find that it is used in MVC .

In other places, this may mean that this variable or file is private and can only be accessed by a server or a running program. It all depends on the language you are programming, but this is just a naming convention.

0
source share

This is just a naming convention. When you want to define a name for an interface, you define it with (_interface). This applies only to compatibility issues. In some cases, a program may include classes and interfaces. And in order to distinguish between the two, you use _ for interfaces. This is just one example, since you can use it in the BLL layer when working with databases and so on.

This is an underline for another developer to notice variables and objects.

0
source share

All Articles