Got everything installed yesterday (Ruby, Gems, Jekyll, etc) and fired up a new Jekyll site. Then I did Jekyll serve and everything worked as expected. I was able to visit my site at localhost 4000 and successfully added a post.
But then when I went to do a Jekyll Build, the CSS is not working on the site. In the head section of all of the HTML files the styles are linked to /assets/main.css; and in the folder structure, there is a main.css in the assets folder. So I am not sure what is going on. I have not adjusted the base and site url settings in the _config.yaml file.
Here is the code I have, can anyone see what might be going on?
If this is such a common issue, why is this not talked about in the documentation on the build process? Is there a process to request this common issue get added to their documentation?
what are you using as a server? if you are just trying to browse files locally without a server it won’t work. Jekell serve fires up a server, build does not.
Interesting, I thought when you do a build it spits out static html/css/js files in the _site folder correct?
Why would you need a server to open index.html in your browser and view the site? When I create a static site by hand, I can open any of the html files and it displays as expected without a server.
correct, you can see this by looking at the _site folder, everything will be there.
You need a server if you expect relative urls to work (I think?) - so /assets/css/site.css won’t work unless you have a server that knows that / is the root of the site folder. I think without a server / is the root of the computer?
If all the assets and html files are in a flat structure then no server is needed if you reference them like href="mycss.css" - with no leading /. Once you put stuff in sub folders I think that is where the server is needed.