-
install dependencies
bundle install
-
run server
bundle exec jekyll serve --livereload
Currently _config.yml is only loaded on the initial jekyll serve command.
If you change config, restart the jekyll server to read the updated data.
You may need to run bundle update
to get the latest version of jekyll used by live github pages.
https://help.github.com/articles/setting-up-your-github-pages-site-locally-with-jekyll/
-
Set up Tutorial
- Chromedriver is required
- You may also need to add
require 'yaml'
to the top of the rack/jekyll.rb file installed by bundler as explained here: bry4n/rack-jekyll#8
-
Run
# all bundle exec rspec # feature tests bundle exec rspec --tag type:feature # data tests (for links etc) bundle exec rspec --tag type:data
# run linter
bundle exec rubocop
# update sourcecode if possible
bundle exec rubocop --auto-correct
- All pages should use the default layout or a layout which inherits from the default layout.
This is because the default layout loads all css/js required by pages. - Pagination only works from index.html pages, hence the need for projects/index.html.
- For jekyll plugins on github pages, the plugin must be included in both _config.yml -and Gemfile.
- Dependencies should be compatible with github pages. see https://pages.github.com/versions/
_data/
contains custom data accessible by jekyll e.g. urls, image paths, etc._includes/
contains partials which can be included in templates._layouts/
contains html templates which can be reused in multiple pages._posts/
actually contains projects, in markdown format.
This is to take advantage of jekylls project pagination plugin.
It also means projects must include a date in their file name to be a valid post._site/
contains the compiled static pages jekyll renders.assets/
contains css, js, images, and third party plugins e.g. lightbox, jstree etc.projects/
contains the html template for rendering the projects home page.scripts/
contains ruby scripts.spec/
contains rspec selenium tests.
<pre>
{{ some_variable | inspect }}
</pre>
To debug tests, can switch to non-healdess browser. e.g. :selenium_headless
-> :selenium
in spec/spec_helper.rb
jekyll has issues with curly braces, so copying raw markdown from dev.to may cause formatting errors. to fix this use the {% raw %}...{% endraw %} syntax. this can be done in vscode with a find and replace regex:
find: \{\{(.*)\}\}
replace: {% raw %}{{$1}}{% endraw %}
run bundle exec ruby scripts/build_images_yml.rb
to generate output for _data/images.yml
.
e.g. bundle exec ruby scripts/build_images_yml.rb > _data/images.yml
.
required so tests know image path and can check they render.