Jekyll/SASS site not compiling via Ruby running on Windows 7, tested also with Prepros, site a no go - ruby

I have Jekyll 2.4.0 and Ruby 2.0.09576 installed.
I am working along with Travis from YouTube channel 'DevTips' and using all of his files/information to compile his 'Artist' project site. Last week I successfully served the project site via Ruby/Jekyll serve from source folder. Today, I tried the same process and the site would not compile. I am using same localhost:8000, that is verified and worked last week. I am running Win7 64bit and followed advice to run UTF-8 encoding command: chcp 65001.
No files have changed in the portfolio folder on my PC, NO windows updates or other software installed. The other thing on jekyllrb.com/windows/ says is to add a line of code for 'Auto-regeneration' to the 'Gemfile'...OK, it does not say where this 'Gemfile' is to edit...is it here?: C:.../RubyDevKit/bin/gem.windows batch file?
I am stumped as to why the project files compiled and displayed just fine last week and today it does not work, NO connection can be made to localhost:8000...so no site generated. I also tried to view view site via Prepros, using their 'Open Live Preview' and that generates a site on localhost:8001 displaying only this text: --- --- {% include header.html %} {% include about.html %} {% include work.html %} {% include clients.html %} {% include contact.html %} {% include form.html %} {% include footer.html %}
I've tried other localhost addresses...8000 through 8005.
Any ideas?
Thank you!
Mark

Have you changed the localhost adress?
Default localhost for jekyll is 4000.
Also Prepros live preview will not work in your jekyll folder, because the acutal site is
rendered within the _site-folder. This folder is what jekyll serve generates.
So can you maybe access the site over localhost:4000 and/or is the _site-folder there? Or does jekyll just not work at all?

SOLVED! I will be buying 'Mixture' front end developer framework software! Enough of the bugs and wasted time coming mostly from lame Windows software issues!
CHEERS!
Mark

Do you have the latest version of Python Installed? I had the same issue but after installing python's latest update (2.7.9) the issue was resolved.

Related

Folder _data in theme directory does not get the values

I'm making a Jekyll theme using the command jekyll new-theme mytheme. I want to add translations to this theme, so I created the file _data/translations.yml into the root directory. This is its content:
---
en:
post: "Post"
es:
post: "Artículo"
I get the information with this expressions:
{% assign t = site.data.translations %}
{{ t[site.lang]['post'] }}
This setup only works if I move the _data/translations.yml file to my Jekyll website directory, created through the command jekyll new mysite.
Are the data files out of themes territory? Should I place this yml file in another directory? If it's not possible to use it in the themes territory, I would like to set a default value: how can I achieve this?
Thanks in advance.
As of Jekyll 4.0, yes, data files inside a theme-gem are not read.
You'll need to use a plugin named jekyll-data (authored by me).
If you plan to publish the theme for other users, I recommend adding the plugin as a runtime dependency in the theme's gemspec. Otherwise, simply adding the plugin to the :jekyll_plugins group in the site's Gemfile will suffice.

Fresh Jekyll Install on Sierra OS

I have never installed Jekyll before, this is my first time.
I went through the process of installing xcode, ruby version 3.2.1 installed, jekyll version 3.2.1 installed. All of this is was freshly installed in the last 2 days.
When I go to localhost:4000 I get the content of the default jekyll page, but none of the style. It looks like this:
Unstyled Default Jekyll Page
Here is what the file structure looks like, I have not changed any file at all since installing. File Structure
When I inspect the page it gives this as its css link as:
<link rel="stylesheet" href="http://example.com/css/main.css">
I am at a loss of how to continue. Can anyone help me?
The css is a bit messed up because the domain is wrong in the _config.yml. You can remove the example url and it’ll work nicely.
Should look like this.
baseurl: "" # the subpath of your site, e.g. /blog
url: "" # the base hostname & protocol for your site
If you get a domain you can update then.
UPDATE:
As mentioned in the comment below, this is now fixed and set by default in Jekyll 3.3.0.
When you generate a new site the css should link-up properly and the relevant section of the _config.yml will look like this:
baseurl: "" # the subpath of your site, e.g. /blog
url: "" # the base hostname & protocol for your site, e.g. http://example.com

How to url encode in jekyll liquid?

I have problem that categories are not url encoded when I use german words with Umlauts (e.g. ä, ü). I tried the cgi_escape that Liquid seems to offer, but success with the following code:
<strong>Kategorien</strong><br/>
{% for category in site.categories do %}
<small>{{ category[0] }} <br/>
</small>
{% endfor %}
Can anyone help?
Using cgi_escape doesn't work correctly for categories with spaces. Links were generated as /category/the+category instead of /category/the%20category.
The solution I ended up using was from this blog post:
# _plugins/url_encode.rb
require 'liquid'
require 'uri'
# Percent encoding for URI conforming to RFC 3986.
# Ref: http://tools.ietf.org/html/rfc3986#page-12
module URLEncoding
def url_encode(url)
return URI.escape(url, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
end
end
Liquid::Template.register_filter(URLEncoding)
A plus is a literal plus anywhere but in the query portion of the URL, where it represents a space. Good URL encoding reference (archive.org mirror).
This can then be used in a layout or anywhere else:
<a href="{{ site.category_dir }}/{{ category | url_encode }}">
#Peterb, have you upgraded to the latest version of Jekyll? The current 1.0x version supports UTF-8 and handles URLs like this much better.
You can install the latest version by running this from your Terminal command line:
$ [sudo] gem install jekyll --pre
This GitHub Issue post will shed more light on the issue:
https://github.com/mojombo/jekyll/issues/960

Dajaxice not found on production server

I have a Django 1.4 project, running on Python 2.7 in which I'm using Dajaxice 0.5.4.1. I have set it up on my development machine (Windows 7) and everything works perfectly. However when I deploy my app to production server (Ubuntu 12.04) I get 404 error for dajaxice.core.js file and cannot resolve this problem no matter what. Production server works with exactly the same versions of all software.
My project structure looks like this:
/myproject
/myproject/myproject-static/ <-- all the static files are here
/myproject/myproject-static/css/
/myproject/myproject-static/img/
/myproject/myproject-static/js/
/myproject/templates/
/myproject/myproject/
/myproject/main/
/myproject/app1/
/myproject/app2/
/myproject/app3/
etc.
I was following the Dajaxice installation steps here and put everything in its place (in settings.py, ˙urls.pyandbase.html` files).
My settings.py file has also these values:
from unipath import Path
PROJECT_ROOT = Path(__file__).ancestor(3)
STATIC_ROOT = ''
STATIC_URL = '/myproject-static/'
STATICFILES_DIRS = (
PROJECT_ROOT.child('myproject-static'),
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'dajaxice.finders.DajaxiceFinder',
)
DAJAXICE_MEDIA_PREFIX = "dajaxice"
DAJAXICE_DEBUG = True
I have an Alias directive in my django.conf file which looks like this:
Alias /myproject-static/ "/path/to/myproject/myproject-static/"
I did collectstatic on my production server and got all static files collected within few folders in the root of my project. So, now when I look at my deployed web site, I can see that CSS is properly applied, JavaScript is working fine and navigation around the site works as intended. Everything is fine except Ajax is totally broken since dajaxice.core.js is never included.
My project folder structure after collecting static looks like this:
/myproject
/myproject/myproject-static/ <-- all the static files are originally here
/myproject/myproject-static/css/
/myproject/myproject-static/img/
/myproject/myproject-static/js/
/myproject/templates/
/myproject/admin/ <-- folder created with 'collectstatic' command
/myproject/css/ <-- folder created with 'collectstatic' command
/myproject/dajaxice/ <-- dajaxice.core.js is located here
/myproject/django_extensions/ <-- folder created with 'collectstatic' command
/myproject/img/ <-- folder created with 'collectstatic' command
/myproject/js/ <-- folder created with 'collectstatic' command
/myproject/myproject/
/myproject/main/
/myproject/app1/
/myproject/app2/
/myproject/app3/
etc.
Am I doing something completely wrong with my static files here?
What else should I try to fix this simple error?
Have you check if as the rest of the assets, dajaxice.core.js is inside your static/dajaxice folder? If not, the issue could be related with a miss configuration of the STATICFILES_FINDERS, check Installing dajaxice again
Another usual issue with collectstatic and dajaxice is to run the first using --link Are you using this option?
Hope this helps
I spend several hours grappling with this problem. It was crazy because everything worked great on my dev environment, but not on the test server even though all the dajax and dajaxice settings were on a common base settings file. I never got it to work using the standard route. But this is a very easy fix:
1) Download dajaxice.core.js into whatever static directory pleases you. You can find the js in your the dajaxice directory in your project root:
project/dajaxice/dajaxice.core.js
In my case, I put the file in static/js alongside all my other js libraries.
2) On your web page, replace this:
{% dajaxice_js_import %}
with a normal, everyday link to the js library. In my case:
<script src="/static/js/dajaxice.core.js" type="text/javascript"></script>
Unfortunately, this patch only works for developed code. If you usedo it in the development environment, new dajaxice code will be registered in the original project/dajaxice/ location and so the file will have to be copied to static after any new code is developed.

How can I debug plugins that are being silently ignored?

Newcomer to Jekyll here (previously on Hyde).
Ruby files placed in the _plugins/ directory are apparently silently ignored.
I am using version 0.11.2 of Jekyll, with ruby 1.8.7 on Ubuntu 12.04.
Should an extra config parameter be added to load these plugins? The doc doesn't say so - the sane default should be to look into _plugins, and they should be required automatically. How can one debug the loading of Jekyll plugins?
For my instance of jekyll (also 0.11.2, but with ruby 1.9.2p290 on a Mac), I don't have to add any extra configuration, but you can try adding the following line to your top level "_config.yml" file.
plugins: _plugins
or, possibly,
plugins: ./_plugins
The simplest way to test that your plugins are working is to remove all of them except for one that you know will work. I've put together the following which works as expected on my install.
Create a new file in the root of your jekyll source directory called "plugin_test.md" with the following contents:
---
layout: default
title: Plugin Test
---
the quick brown fox jumps over the lazy dog.
Testing plugin output of '_plugins/testplugin.rb': {% testplugin %}
Note that you may need to change "layout: default" to whatever you are actually using.
Create a new file at "_plugins/testplugin.rb" with the following contents:
module Jekyll
class TestPlugin < Liquid::Tag
def render(context)
"It's Working!"
end
end
end
Liquid::Template.register_tag('testplugin', Jekyll::TestPlugin)
Run jekyll on your source dir.
All that testplugin.rb does is replace instances of the liquid tag {% testplugin %} with the text "It's Working!". If your plugins are triggering, you'll see the output
Testing plugin output of '_plugins/testplugin.rb': It's Working!"
on the page "plugin_test.html" at your output site root. If you see:
Testing plugin output of '_plugins/testplugin.rb':
that means that the plugin didn't trigger. If you run into that, I think it's a sign that something is pretty out of whack and would advise reinstalling jekyll.
I know I'm little bit late but for others who still come across this question I would like to add my resolution:
Restart the server to get the newly added plugin working. So stop jekyll serve (Ctrl C) and restart it again with jekyll serve.

Resources