If you override the CSS on a theme (eg Minima) it requires that you create a file /assets/main.scss
and in that file you need to include front matter. eg:
---
---
@import "{{ site.theme }}";
body {
color:blue;
}
Unfortunately, when using VSCode, the scss linter complains about the front matter:
[scss] at-rule or selector expected
This does not stop the file from being used in Jekyll but the red error is annoying in VSCode and masks other real errors in your project.
To fix this:
- In VSCode, add your /assets folder as a Workspace folder (right click in the Explorer > Add Folder to Workspace. In VSCode you can have “nested” workspace folders.
- Go to Preferences > Settings. On the Settings page there are three levels of settings : User Settings, Workspace Settings and Folder Settings. Click the tab for Folder Settings.
- In the drop down on the Folder Settings tab header, select your
assets
folder. - Add your setting:
{
“scss.validate”: false
}
This turns off scss linting for just the assets
folder and the error should go away. Yes, you lose linting so you will need to check your code yourself!
Cheers,
Murray