Do files ignored in '.gitignore' not run at all?

I want to make a project in React.js, that uses images that would only run when the device orientation is a specific one. In short, this is Media Queries of CSS.

But now if I were to edit the .gitignore file as to ignore the Media Query Images, then will the images be blocked and couldn’t be run at all?

No, editing the .gitignore file to ignore the Media Query Images will only affect version control and Git repository management. It will not affect the functionality of your React.js project.

However, if your project depends on these images and they are not included in your source code or build process, they will not be available for your users. So, if you want your project to use Media Query Images, you should make sure they are included in your project’s source code or build process, even if they are ignored by Git.

You can also consider hosting these images on a third-party service or a Content Delivery Network (CDN) and reference them in your code or build process, rather than including them directly in your project. This can help to reduce the size of your project and improve its performance.

So do images in the src folder count as source code?

No, images in the “src” folder are not technically considered source code, they are still an important part of a web project and should be included in the project’s version control system along with the source code files.

Thanks for the solution!

No, editing the .gitignore file to ignore certain images will not prevent those images from being used in your React.js project or from being displayed based on media queries in CSS.

The .gitignore file is used to specify intentionally untracked files that Git should ignore. It’s typically used for files that are generated during the development process or files that shouldn’t be included in version control, such as build artifacts, temporary files, or sensitive information like API keys.

When you add files to the .gitignore, Git simply won’t track changes to those files or include them in commits. It doesn’t affect how your project functions or how files are accessed by your application.

In your case, if you have images that are used conditionally based on device orientation using media queries in CSS, ignoring those images in the .gitignore file won’t impact their functionality. As long as the images are present in the correct directories within your project and referenced properly in your React components and CSS files, they will be accessible and displayed as intended based on the media queries.