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

Liquid in SCSS #2692

Closed
rnkn opened this issue Aug 5, 2014 · 5 comments
Closed

Liquid in SCSS #2692

rnkn opened this issue Aug 5, 2014 · 5 comments

Comments

@rnkn
Copy link

rnkn commented Aug 5, 2014

Unless I'm missing something, the following SCSS should work:

---
layout: none

---

body {
    background-image: url({{ "/background.jpg" | prepend: site.assets_url }});
}

but it results in the error

Conversion error: There was an error converting 'css/main.scss'.
jekyll 2.2.0 | Error:  Invalid CSS after "...und-image: url(": expected ")", was "{{ "/background..."
@pathawks
Copy link
Member

pathawks commented Aug 5, 2014

@parkr commented

Just note that the process is:

  1. Convert Sass/SCSS to CSS
  2. Render CSS in Liquid

You are trying to pass a Liquid tag when SCSS expects a URL, and it chokes.

@parkr
Copy link
Member

parkr commented Aug 5, 2014

We're tracking this in #2573. Thanks @pathawks.

@parkr parkr closed this as completed Aug 5, 2014
@rnkn
Copy link
Author

rnkn commented Aug 5, 2014

Ah sorry. Am I better to use the following?

$assets_url: "http://raw.githubusercontent.com/rnkn/rnkn.github.io/assets";

body {
    background-image: url(#{$assets_url}/background.jpg);
}

@parkr
Copy link
Member

parkr commented Aug 5, 2014

Something like that. Try this instead though:

$assets_url: "http://rnkn.github.io/assets";

body {
    background-image: url(#{$assets_url}/background.jpg);
}

Loading from GitHub.com will be slower.

@rnkn
Copy link
Author

rnkn commented Aug 5, 2014

The assets is actually a separate branch, so I get a 404 if I go directly. Wanted to keep binary files outside of the site code, hence the variable malarkey (it was Dropbox before).

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants