How to git ignore files in a svelte project with example

Learn how to ignore files for git commit in the svelte application.

Svelte is a compiler for generating JavaScript which runs as a web application or a single component.

There are different types of things that can be ignored during committing the files from the svelte project.

  • npm build target files
  • logs
  • Runtime process data
  • Istanbul code coverage tools
  • Dependency modules folders
  • Environment files
  • The editor temporary generates files

What files are ignored in the svelte project for the gitignore file

Multiple files generate with svelte project creation. You can also add multiple files and folder paths to the .gitiignore file in a root folder or anywhere in the project.

  • npm build target files

svelte is based on NodeJS, It generates a dist folder

# build folder
dist/
build/
  • logs

The application generates temporary logs in the root folder. Each manage manager also generates log files such as npm-debug.log, yarn-debug.log, and yarn-error.log

# logs
logs/
.cache
.DS_Store
npm-debug.log
yarn-debug.log
yarn-error.log
  • Runtime Process Data During the running project, It generates process id and data
# process data
.pid
pids
.pid-lock
  • test and coverage folder

Unit testing and code coverage generate files and folders

# Coverage & Test
coverage
.nyc_output
  • Dependency folders

node_modules generates for the npm package manager bower_components for the bower package manager

# Dependency folder
node_modules
bower_components
jspm_packages
  • Package manager’s temporary files
# Dependency folder
.grunt
.npm
.yarn
.next
.yarn-integrity
*.tgz
  • Environment files

dot environments contain private keys which are not committed to the repository

# Environment files
.dot
  • Editor other files

the opening project generates IDE temporary files.


# Dependency folder
.grunt
.npm
.yarn
.next
.yarn-integrity
*.tgz


# Editor and other files
.idea
typing
internal
.vscode
*.tgz
.eslintcache
.svelte-kit

Svelte gitignore sample example file

Here is the sample svelte gitignore file placed in the root folder of a project.

# build folder
dist/
build/

# logs
logs/
.cache
.DS_Store
npm-debug.log
yarn-debug.log
yarn-error.log

# process data
.pid
pids
.pid-lock

# Coverage & Test
coverage
.nyc_output

# Dependency folder
node_modules
bower_components
jspm_packages

# Environment files
.dot
# Editor and other files
.idea
typing
internal
.vscode
*.tgz
.eslintcache
.svelte-kit