Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to lint files with YAML front matter #787

Closed
shawnbot opened this issue Apr 27, 2016 · 3 comments
Closed

Unable to lint files with YAML front matter #787

shawnbot opened this issue Apr 27, 2016 · 3 comments
Labels

Comments

@shawnbot
Copy link

I have a .css file in a Jekyll site that's structured like this:

---
# this needs YAML front matter to be compile by Jekyll's Sass

---
@import 'variables';

.blah {
  color: $red;
}

Jekyll dutifully strips the front matter and passes the rest off to Sass, but both the sass CLI and scss-lint barf on it:

css/blah.scss:5: Invalid CSS after "...ort 'variables'": expected "{", was ";" (Sass::SyntaxError)

When I remove the front matter, sass and scss-lint are able to parse and lint it, but then Jekyll doesn't recognize it as a Sass stylesheet. So I keep the front matter and push it to github, but then Hound CI reports these errors as fatal when linting.

I wasn't able to find any solution to this by searching the issues or googling, but is this a known problem? Is there a workaround, or is the fix to have scss-lint strip front matter before sending it to Sass for parsing?

@sds sds added the question label Apr 27, 2016
@sds
Copy link
Owner

sds commented Apr 27, 2016

See the section in the README on preprocessing.

@connorshea
Copy link
Contributor

Just FYI if you have this problem and all your stylesheets have the same number of frontmatter variables you can use preprocess_command: "sed '1,3d'", where 3 is the line upon which the "closing" --- is found.

Thought this might be useful to someone in the future.

@ortonomy
Copy link

ortonomy commented Mar 12, 2017

Check out this issue that I fixed myself - this will solve this problem with SCSS Lint + Jekyll

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants