It's possible to have a livereload (or browsersync) like system that run with jekyll serve without using other tools like grunt/gulp?
What I'm expecting is to edit a css, sass, html or md file and have the browser page auto reloading.
I'm using Jekyll 2.5.x
As of January 2018, Jekyll 3.7 now has the --livereload flag.
jekyll serve automatically rebuilds the _site folder whenever changes are saved.
--livereload refreshes the browser with those changes.
So, use jekyll serve --livereload.
Related
I recently revived my old Jekyll project started with Jekyll 3.x (now using Jekyll 4.2 and I forgot a lot). The generated site is OK if browsed with jekyll serve command, but if later I manually enter _site folder and click index.html the site ignores css rules and links are broken.
This makes me nervous how to deploy the site. What I'm doing wrong?
Your site is served from a development web server when you run jekyll serve. I'm assuming by click index.html, you mean you are opening the file in your web browser - this won't work well with the absolute URLs Jekyll creates.
You can see the difference in the URL bar: one will say http:// and the other will be file://, a URL like /css/main.css will likely only work through the web server (i.e. jekyll serve).
Assuming you are deploying the site to a web server, and it works with jekyll serve, I'd guess it's fine. I can't be sure, but in any case, You should probably back up what's on the server currently though so you can restore it.
I have a GitHub Pages site that I generated by creating a repository and choosing a theme on GitHub. While the site is technically built using Jekyll, it has no gemfile, and the _config.yml is very concise:
theme: jekyll-theme-dinky
title: "<site name>"
In contrast, proper Jekyll sites created with jekyll new . have proper gemfile and gemfile.lock files, and a verbose _config.yml. Pardon my general ignorance with Jekyll and Ruby, but I assume these are necessary for Jekyll to build the site locally.
Running jekyll serve on a local clone of my site doesn't build the site properly. Yet GitHub's own pipeline can.
The question: Is there a way to locally build and preview my site without adding a gemfile/gemfile.lock and changing _config.yml? I.e. do exactly what GitHub's pipeline does, just on my computer.
I'm working on a Jekyll site with GitHub Pages and have found that {% include myinclude.html %} liquid works just fine inside _includes and _layout files. However, when adding elements to the _config.yml such as author : myusername and attempting to use them either in the _layouts/default.html or _includes/myinclude.html as {{ site.author }}, the resulting text is just blank. To note, these changes are not committed or pushed and I'm using a local jekyll instance installed on the Linux Subsystem for Windows.
Outside of _includes and _layout in my actual pages the site variables work just fine. Why would the site variables not be displayed? At the moment I have to place the actual values back into the page.
The above is the intended behaviour, every change to _config.yml needs the development server to be restarted to process new settings.
The configuration file can't be re-read when using watch, because it
contains things like source and destination. It could only work if it
were actually like running jekyll build multiple times
source
With the assumption that edits to the _config.yml would update automatically, as Jekyll does for edits to other files, I had not restarted the jekyll instance I originally started. Simply closing the Jekyll instance and starting it back up, with bundle exec jekyll serve in my case, read the updated config file and the {{ site.variables }} appeared and showed correctly as I expected.
Any changes to the _config.yml require restarting the Jekyll instance.
I created a simple jekyll site as https://github.com/nagachinta/nagachinta.github.io, but throws 404 error. I observed the git commits I made and the commits in the git says.
" A file was included in about.md that is a symlink , doesnot exist in your '_includes', directory."
The file is not a symlink, it's just a real file.
The index files , etc are real files not symlinks.
You're using Jekyll 3.2 locally. This means that you're now using gem based themes. No more _includes, _layouts and _sass folder when you do your jekyll new.
On the other side github pages uses Jekyll 3.1.6 (reference).
So when you pull a site created without _includes, _layouts and _sass folders on github pages, it results in build errors. Your site is not created and you get 404s errors.
If you want to be sure that a site developed locally to work on github pages, you can go with gh-pages gems. See install instructions here.
If you just want to stay with jekyll 3.2 locally and copy themes's files, you can have a look at this answer.
So I am using Jekyll Bootstrap, which is also available on GitHub, in order to build my blog (which is currently just full of filler content for development). One thing I noticed is that when running my local development server using the command
$ jekyll --server --auto
I am able to edit my markdown content and have it auto regenerate the local site while I am changing things. As far as I can tell this does not work for my CSS or for my templates. I also noticed that when I run the local server with the --auto flag Jekyll creates a directory called auto which stores what appears to be a static copy of my site's content. Jekyll-bootstrap comes with it's own .gitignore file set up for you which I assumed contained the auto directory. I see no reason to store this auto-regenerated content in the GitHub repository for my site, however, when I made a commit I noticed it added the entire auto directory. I opened up the .gitignore file and this is what it contains:
_site/*
_theme_packages/*
Thumbs.db
.DS_Store
!.gitkeep
.rbenv-version
.rvmrc
I am very new to Jekyll and Jekyll Bootstrap, and a little new to git. I am not sure if there is a reason why they wouldn't have an entry to ignore the auto directory. I was figuring I should add an entry for auto/*. Is there a reason I shouldn't do this? As far as I can tell there is no use for the auto directory for anyone that either downloading the site from the web or from its git repository?
You can put it in your gitignore file. When deploying your site, you'll generally build it into the _site directory and publish it somewhere (your own VPS, GitHub pages, etc).