Concepts
The .divignore file
Keep files out of your deploys with familiar gitignore syntax.
The .divignore file
A .divignore file in your project root tells div deploy which files to leave behind when uploading. The syntax is exactly the same as .gitignore, so there's nothing new to learn.
div new scaffolds an empty (commented) .divignore for you, so you can start adding patterns right away without creating the file first.
#When you'd want one
- You've got draft files sitting alongside published ones.
- You're using a design tool that drops binary files into the project (
.sketch,.fig, etc.). - You've got notes, TODOs, or spec documents that aren't meant for the public.
- You've got a
Brewfile,Makefile, or other project-management files that shouldn't ship.
#Built-in defaults
Even without a .divignore, div deploy already skips:
node_modules
.git
.DS_Store
.env*
div.json
*.log
These can't be re-included. If you genuinely need to publish a .env.example (you almost certainly don't), give it a different name.
#Syntax
Identical to gitignore:
# Comments start with hash
# Match a single file
TODO.md
# Match a directory
drafts/
# Match by extension
*.sketch
*.draft.html
# Match anywhere in the tree
**/scratch/
# Negate (re-include something previously excluded)
*.tmp
!important.tmp
Patterns are matched relative to your project root.
#Examples
A few common shapes for real projects:
# Don't ship design source files
*.sketch
*.fig
*.psd
*.ai
# Don't ship raw photos — only the optimized versions in /img
photos-raw/
# Don't ship draft pages
drafts/
*.draft.html
# Don't ship internal docs
NOTES.md
TODO.md
spec/
Or for a project that uses a separate tool to build CSS:
# Source — don't ship
styles/src/
*.scss
# Built output — do ship (default; this is implicit)
#What it does not do
.divignore only affects what div deploy uploads. It does not:
- Hide files in the local dev server (
div start). Everything in the folder is reachable athttp://localhost:3000/regardless. If you don't wantdrafts/post.htmlaccessible locally, don't put it in the folder. - Affect git. Your
.gitignoreis its own separate thing. - Delete files from a previous deploy. If you used to ship
secret.htmland you add it to.divignore, the nextdiv deploywon't upload it — but the previously-uploaded copy stays on the server. Delete it through the editor atdiv.soif you need it gone.
#Debugging skipped files
div deploy doesn't print which files were skipped (intentionally — we like the output to stay quiet). If you're not sure whether a file is making it up:
- Check that the path doesn't match any built-in default.
- Check your
.divignorepatterns. - Check that the file isn't over the 10 MB per-file limit (those get silently skipped with a warning at the end).
#See also
div deploy— when.divignoreactually gets consulted.- Project structure — the surrounding layout.
- Limits — the other reasons a file might not get uploaded.