I am trying to build a website using blogdown, and the Hugo theme Sam.
This theme has SASS files that get converted into a minified css file.
When I change something in the SASS file, like for example the background color, it is not taken into account when using serve_site.
Is there a way to make this work using blogdown?
A way to reproduce the issue is:
Create an empty directory called for ex. test_sam, and set it as a working directory
then do:
library(blogdown)
new_site(theme = "victoriadrake/hugo-theme-sam")
Try to change something in test_sam/themes/hugo-theme-sam/assets/sass/style.sass, for example:
change
html
background-color: $dark-grey
to
html
background-color: $white
This doesn't produce any change.
Color variables (such as $white) are defined in test_sam/themes/hugo-theme-sam/assets/sass/_vars.sass
The odd thing is that if I change it to an undefined variable name like $yellow, I get the following error message:
Building sites … ERROR 2019/12/27 20:44:39 Transformation failed: SCSS
processing failed: file "stdin", line 11, col 23: Undefined variable:
"$yellow". Total in 197 ms Error: Error building site: logged 1
error(s)
which shows that blogdown does access the sass files to build the site.
I have very little knowledge about website building nor css, so maybe there is something quite obvious that I'm not getting.
Thanks for your help!
Although late to answer, I solved this issue with the same theme by setting the "blogdown.generator.server" option to TRUE.
options("blogdown.generator.server" = TRUE)
blogdown::serve_site()
Update: This actually seems to be a common issue with the Sam theme specifically. The theme uses some tools not included with Hugo, and you have to download them separately. It's addressed in the README.
Open Terminal and run:
npm install -g postcss-cli
npm install -g autoprefixer
After that, blogdown::serve_site() worked normally for me. It also fixed some plot rendering issues I was having.
Related
I am running R in Visual Studio Code. I would like to get rid off the Lines should not be more than 80 characters.line_length_linter warnings marked as wavy underlines. I would like to get a global effect so that the warnings are removed from all R files I create wherever I want.
Could someone clarify this and this discussions a little. I already tried to put the following line:
linters: with_defaults(line_length_linter=line_length_linter(10000))
in .lintr file I created. I tried both locations R-4.2.2\library\lintr and R-4.2.2\library\lintr\R. In the later one there is the pre-existing lintr file without .. No help, I also tried:
linters: linters_with_defaults(line_length_linter=line_length_linter(10000))
and it didn't help either. I tried to relaunch the VSCode after the changes.
Edit: if I put the .lintr file with the following line into a higher-level folder of the R script I write, the warnings are gone (the lintr package is installed and is working).
linters: linters_with_defaults(line_length_linter=line_length_linter(10000))
The problem
I'm running into a conflict error and a strange issue where my Homepage title is modified and "- Page 2" appears in the tab itself when I place a certain post inside the _posts folder. When I take this specific post out, the problem is resolved. The blog post itself works properly and I'm not encountering other issues. I'm running Minimal Mistakes theme and I'm knitting .Rmd reports in RStudio with GitHub flavored markdown.
Link to my main repo
Link to the specific post inside repo
Link to config.yml
YAML header for knitting .Rmd
title: "Data visualisation"
date: "`r Sys.Date()`"
output:
md_document:
variant: gfm
Knitting options for Rmd
library(knitr)
# macOS
# setwd("~/Developer/mkruisbrink.github.io/_reports/R-for-data-science/01-explore/01-data-visualisation/")
# Windows
setwd("D:/Max Kruisbrink/Developer/mkruisbrink.github.io/_reports/R-for-data-science/01-explore/")
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file())
# define knitr paths for macOS
#base.dir <- "~/Developer/mkruisbrink.github.io/"
# define knitr paths for Windows
base.dir <- "D:/Max Kruisbrink/Developer/mkruisbrink.github.io/"
base.url <- "/"
fig.path <- "assets/reports/R-for-data-science/01-explore/01-data-visualisation/"
# set knitr parameters
opts_knit$set(base.dir = base.dir, base.url = base.url)
opts_chunk$set(fig.path = fig.path)
I get a neat .md file which I can place inside my _posts folder with some yaml header. All other posts are processed fine, the error only appears when I place this specific post inside the folder.
YAML header for post
title: "The basics of data visualisation in R"
excerpt: "These are the basics of visualizing data in R, using only the tidyverse functionality"
header:
overlay_image: /assets/images/midjourney-optimised/big-computer-screen-financial-dashoard-optimised.jpg
category:
- Exploration
What I've tried so far
I've tried the following:
Spent at least 2 hours on online research, didn't find any proper relevant sources to help me out here
Manually removing from and adding back all posts from the _posts folder to figure out the problem lies with this specific post
Running bundle update and bundle install
Double checking YAML headers for posts and the config file
Checking .Rmd settings for other reports that are knitted in the same way and cause no issues
Removing the post content from the .md file to see if the bug came from something in the code perhaps
Replacing the whole YAML header with that of a post that causes no issues
Ran --trace in combination with bundle exec jekyll serve for the same conflict results
Ran --verbose in combination with bundle exec jekyll serve and I could find ONE extra instance of something writing index.html to _site. So the following appears twice in the log. I know the culprit is this post but how to get more info on what is causing it?
Writing: D:/Max Kruisbrink/Developer/mkruisbrink.github.io/_site/index.html
Conclusions and questions
I'm starting to run out of options for my current skill level of debugging.
Could it be something relating to _includes or _layouts? I might have tweaked layouts but pretty sure I left the includes folder alone. But why would other posts be unaffected?
Could it be plugin related? I had no problems up until last week suddenly and didn't change any plugin.
Should I update to the latest theme, removing any customization I've done to rule that out
I'm running this in my gemspec
source "https://rubygems.org"
gemspec
gem "webrick"
gem "jekyll-remote-theme"
gem "tzinfo" #windows dependancy?
gem "tzinfo-data"
Can someone point me in a direction here? Getting slightly clueless and I want to be a little cautious with my re-rolling. Thanks in advance!
Edit 2022-12-28
When I remove the permalink: \ from the main index.html file, the error is resolved but when building the site with bundle exec jekyll serve a strange page2 folder is created in _site with its own index.html
However, I still think something is off with certain posts as the error is resolved when I move them to _drafts.
Anyone any thoughts?
There was an issue with the _config.yml file where I was mixing liquid syntax and the pagination plugin.
# Outputting
permalink: pretty
paginate: 5 # amount of posts to show
paginate_path: /page:num/
timezone: Europe/Amsterdam # https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# Plugins (previously gems:)
plugins:
- jekyll-paginate
changing the outputting into the following solved my issue.
# Outputting
permalink: /:categories/:title/
timezone: Europe/Amsterdam # https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
My final cue was the page2 folder that was being built and the fact that EVERY post that I added to my _posts folder above the number 5 was causing issues.
I am using Jupyter in Windows.
I mean to change coloring of the QT console.
How can I select one of the built in CSSs as the default, via configuration file?
I mean to avoid passing it as an argument as in jupyter qtconsole --style monokai.
I would rather use a configuration file, e.g. file1 = %USERPROFILE%\.jupyter\jupyter_qtconsole_config.py
What I ultimately want to do is write monokai in some configuration file, and have the QTconsole load the built-in monokai.
What I tried so far:
As a test, execute
jupyter qtconsole --style monokai.
It actually brought monokai (white fgr on dark gray bgr). Moreover, it combined well with my selected c.ConsoleWidget.font_size = 12 in file1.
Then, trying to use my own css.
I copied a monokai.css file in C:\Users\user1 (I have quite a few in my system, but I guess any one should work for the most basic stuff).
In file1 I included one of the lines
c.JupyterQtConsoleApp.stylesheet = u'C:/Users/user1/monokai.css'
c.JupyterQtConsoleApp.stylesheet = 'C:/Users/user1/monokai.css'
c.JupyterQtConsoleApp.stylesheet = 'C:\\Users\\user1\\monokai.css'
None worked.
If I made this work, I would still have to find how to replace the specification of a file as a location by a simple CSS name among the built-in.
PS: I know I could also set a Windows shortcut that launches jupyter qtconsole --style monokai.
I also mean to avoid this.
This is a solution, but I am not certain it is the only one, or if it is the most portable across systems.
Note: there might be some issues, yet to be solved, in the way this configuration works, see https://github.com/jupyter/qtconsole/issues/334
Use
c.JupyterWidget.syntax_style = 'monokai'
in file %USERPROFILE%\.jupyter\jupyter_qtconsole_config.py
or ~\.jupyter\jupyter_qtconsole_config.py.
Inspired by this.
While trying to use grunt to convert my sass files into normal css files i get the warning:
Warning: Encoding::CompabilityError: incompatible character encodings: UTF-8 and CP850.
However when I run sass calling the file(s) everything works as it should even though no encoding is specified by me. My Gruntfile.js looks like this:
[...]
sass: {
main: {
files: {
'css/theme/default.css': 'css/theme/source/default.scss',
'css/theme/beige.css': 'css/theme/source/beige.scss',
'css/theme/night.css': 'css/theme/source/night.scss',
'css/theme/serif.css': 'css/theme/source/serif.scss',
'css/theme/simple.css': 'css/theme/source/simple.scss',
'css/theme/sky.css': 'css/theme/source/sky.scss',
'css/theme/moon.css': 'css/theme/source/moon.scss',
'css/theme/solarized.css': 'css/theme/source/solarized.scss',
}
}
}
[...]
which is a part of the Gruntfile.js I forked from the reveal.js on GitHub. I took a look at the grunt-contrib-sass on GitHub and tried to find the option to change the encoding manualy. However it apears that there is none (maybe I just overlooked it?).
I think a keypart of the problem is that I am using Windows 8 and not any Unix based OS.
So my question is:
How do i get rid of this warning? Or how do i fix the code to work properly?
Any help is appreciated.
I had this error when trying to use the command:
sass --watch global.scss:global.css --style compressed
And the cause was the most stupid cause ever... I had this folder: E:\Dropbox[Websites][External] Fundación Global\css and I run the command in there, and SASS returned this same error: Warning: Encoding::CompabilityError: incompatible character encodings: UTF-8 and CP850.
I just needed to take out the ó from the folder's path!
That simple and silly! Just changed this: ...Fundación Global\css for this ...Fundacion Global\css and I have SASS watching with no issues again.
I am trying to knit together 3 files using this example: http://rmarkdown.rstudio.com/rmarkdown_websites.html
My files all share the same directory, which has been set in the RStudio build options. I literally copied the YML from the examples with my own file names. Even if I copy the examples directly, I get the same error.
I even ran the site_generator function from the RMarkdown Github: https://github.com/rstudio/rmarkdown/blob/master/R/render_site.R#L157
I noticed there are options for custom generators, which I do not want. All I would like to do is be able to knit together several markdown files into a single webpage and then create a navbar with tabs for each page/section.
I got the same error when attempting to build with an incorrectly named YAML config file. Specifically, the RStudio build option for a website requires that the config file be called _site.yml.
Verify that this file exists and that you're using the extension .yml rather than .yaml (even though the latter is preferred).
What helped for me was putting the line site: bookdown::bookdown_site back to index.Rmd.
lord, my issue was that i didn't set my working directly to where my _site.yml file and index.Rmd files are stored - the little things!
I fixed this error using this steps.
1-) RStudio-Tools-InstallPackages
2-) Install From should be CRAN Repository.
3-) write this command --> install.packages("install.packages("rmarkdown")")
4-) Click Install
And problem has gone... And this is output.
This error also appears when there is a format issue in the yaml section of index.Rmd.
In my case, I encountered the error when the opening "---" in index.Rmd had a couple of white spaces " ---".
If you are having this problem, I would recommend knitting index.Rmd by itself (not building the book) before trying anything more drastic.