I\'m building a site with Jekyll and using Gulp to manage the assets. Since I\'m using Gulp to manage my assets, I would like Jekyll to ignore ./assets in the conversion pro
As was noted before keep_files directive is correct, instead of just keep. Following information from Jekyll's site http://jekyllrb.com/docs/configuration/
Destination folders are cleaned on site builds The contents of are automatically cleaned, by default, when the site is built. Files or folders that are not created by your site will be removed. Some files could be retained by specifying them within the configuration directive. Do not use an important location for ; instead, use it as a staging area and copy files from there to your web server.
I decided to check this by doing things from scratch step by step part that I appended to default jekyll's _config.yml file looks like this
exclude: [someFolderHere]
keep_files: [someFolderHere]
creating new jekyll site from scratch
wolf@sloth:~/blogs$ jekyll new dummy-blog New jekyll site installed in /home/wolf/blogs/dummy-blog. wolf@sloth:~/blogs$ cd dummy-blog/ wolf@sloth:~/blogs/dummy-blog$
checking contents of site's folder
wolf@sloth:~/blogs/dummy-blog$ ll -rta
total 40
drwxr-xr-x 12 wolf wolf 4096 Jan 30 09:40 ..
-rw-r--r-- 1 wolf wolf 435 Jan 30 09:40 _config.yml
drwxr-xr-x 2 wolf wolf 4096 Jan 30 09:40 _layouts
-rw-r--r-- 1 wolf wolf 451 Jan 30 09:40 index.html
drwxr-xr-x 2 wolf wolf 4096 Jan 30 09:40 _includes
drwxr-xr-x 2 wolf wolf 4096 Jan 30 09:40 css
drwxr-xr-x 2 wolf wolf 4096 Jan 30 09:40 _posts
-rw-r--r-- 1 wolf wolf 1292 Jan 30 09:40 feed.xml
-rw-r--r-- 1 wolf wolf 470 Jan 30 09:40 about.md
drwxr-xr-x 6 wolf wolf 4096 Jan 30 09:40 .
wolf@sloth:~/blogs/dummy-blog$
running first build
wolf@sloth:~/blogs/dummy-blog$ jekyll build
Configuration file: /home/wolf/blogs/dummy-blog/_config.yml
Source: /home/wolf/blogs/dummy-blog
Destination: /home/wolf/blogs/dummy-blog/_site
Generating...
done.
wolf@sloth:~/blogs/dummy-blog$
checking contents of site's folder again
wolf@sloth:~/blogs/dummy-blog$ ll -rta
total 44
drwxr-xr-x 12 wolf wolf 4096 Jan 30 09:40 ..
-rw-r--r-- 1 wolf wolf 435 Jan 30 09:40 _config.yml
drwxr-xr-x 2 wolf wolf 4096 Jan 30 09:40 _layouts
-rw-r--r-- 1 wolf wolf 451 Jan 30 09:40 index.html
drwxr-xr-x 2 wolf wolf 4096 Jan 30 09:40 _includes
drwxr-xr-x 2 wolf wolf 4096 Jan 30 09:40 css
drwxr-xr-x 2 wolf wolf 4096 Jan 30 09:40 _posts
-rw-r--r-- 1 wolf wolf 1292 Jan 30 09:40 feed.xml
-rw-r--r-- 1 wolf wolf 470 Jan 30 09:40 about.md
drwxr-xr-x 5 wolf wolf 4096 Jan 30 09:41 _site
drwxr-xr-x 7 wolf wolf 4096 Jan 30 09:41 .
now we have _site folder
wolf@sloth:~/blogs/dummy-blog$ ll _site/
total 32
drwxr-xr-x 3 wolf wolf 4096 Jan 30 09:41 jekyll
-rw-r--r-- 1 wolf wolf 5816 Jan 30 09:41 index.html
-rw-r--r-- 1 wolf wolf 2954 Jan 30 09:41 feed.xml
drwxr-xr-x 2 wolf wolf 4096 Jan 30 09:41 css
drwxr-xr-x 2 wolf wolf 4096 Jan 30 09:41 about
drwxr-xr-x 7 wolf wolf 4096 Jan 30 09:41 ..
drwxr-xr-x 5 wolf wolf 4096 Jan 30 09:41 .
wolf@sloth:~/blogs/dummy-blog$
creating some folder under _site
wolf@sloth:~/blogs/dummy-blog$ mkdir _site/someFolderHere
wolf@sloth:~/blogs/dummy-blog$ touch _site/someFolderHere/toasttoast123
wolf@sloth:~/blogs/dummy-blog$
checking if this file is this there...
wolf@sloth:~/blogs/dummy-blog$ ll _site/someFolderHere/toasttoast123
-rw-r--r-- 1 wolf wolf 0 Jan 30 09:42 _site/someFolderHere/toasttoast123
wolf@sloth:~/blogs/dummy-blog$
running build again
wolf@sloth:~/blogs/dummy-blog$ jekyll build
Configuration file: /home/wolf/blogs/dummy-blog/_config.yml
Source: /home/wolf/blogs/dummy-blog
Destination: /home/wolf/blogs/dummy-blog/_site
Generating...
done.
wolf@sloth:~/blogs/dummy-blog$
checking if file toasttoast123 is still present
wolf@sloth:~/blogs/dummy-blog$ ll _site/someFolderHere/toasttoast123
ls: cannot access _site/someFolderHere/toasttoast123: No such file or directory
wolf@sloth:~/blogs/dummy-blog$
creating backup for _config.yml before modification
wolf@sloth:~/blogs/dummy-blog$
wolf@sloth:~/blogs/dummy-blog$ cp -p _config.yml _config.yml.somebackup
adding exclude and keep_files directives and comparing edited file with backup
wolf@sloth:~/blogs/dummy-blog$ rvim _config.yml
wolf@sloth:~/blogs/dummy-blog$ diff -u _config.yml _config.yml.somebackup
--- _config.yml 2016-01-30 09:44:26.238366056 +0200
+++ _config.yml.somebackup 2016-01-30 09:40:08.422370474 +0200
@@ -10,6 +10,3 @@
# Build settings
markdown: kramdown
permalink: pretty
-
-exclude: [someFolderHere]
-keep_files: [someFolderHere]
wolf@sloth:~/blogs/dummy-blog$
creating someFolderHere and dummy toasttoast123 file again
wolf@sloth:~/blogs/dummy-blog$ mkdir _site/someFolderHere
wolf@sloth:~/blogs/dummy-blog$ touch _site/someFolderHere/toasttoast123
running build
wolf@sloth:~/blogs/dummy-blog$ jekyll build
Configuration file: /home/wolf/blogs/dummy-blog/_config.yml
Source: /home/wolf/blogs/dummy-blog
Destination: /home/wolf/blogs/dummy-blog/_site
Generating...
done.
wolf@sloth:~/blogs/dummy-blog$
checking if file is still there
wolf@sloth:~/blogs/dummy-blog$ ll _site/someFolderHere/toasttoast123
-rw-r--r-- 1 wolf wolf 0 Jan 30 09:45 _site/someFolderHere/toasttoast123
wolf@sloth:~/blogs/dummy-blog$
wolf@sloth:~/blogs/dummy-blog$