-
Notifications
You must be signed in to change notification settings - Fork 14
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
Variables with path inside not working #10
Comments
Hmm. Curious. Would you be willing to provide the JSON file (or similar example) that is causing the error to help me reproduce it? |
It is possible that this was corrected when we fixed #11. I can reproduce this issue with This is how I tested: |
Having said that. It certainly looks like this is not the case if you append a file extension. I will look into this. EDIT: or a simple "/", as you have mentioned |
Hi there,
Did you find a solution for that? |
Having the same problem. @nhunzaker Your test narrowly escaped the issue. Try |
Simply wrapping the uri in single quotes resolved the problem for me. E.g.: "url": "'//foo/bar'" |
I have the same issue, any idea how to fix it? |
I've modified the importer to wrap strings contains a file extension with single quots " 'file.ext' " so now it won't trigger an error. def _convert_to_sass(item)
if item.is_a? String
if item.scan(/\.[0-9a-z]+$/i).length > 0
item = "\'" + item + "\'"
end
end
if item.is_a? Array
_make_list(item)
elsif item.is_a? Hash
_make_map(item)
else
item.to_s
end
end |
@ThePolarCat this is great, just what I need, do you have a forked version of this repository or something? How can I use this? |
@esr360 after you clone the repo, navigate to |
I'm glad I found this issue. I was having this problem if a string contained a period anywhere or even a comma. Since my task was a cross-compatible source of definitions for server, js, and css, there's some veriables that are defined in my json file but aren't used by the css. So my core definition file had a line like this Altering @ThePolarCat's regex test to
Update: I also found that empty strings also cause a parsing error. Since my purpose is a file that JS/SASS and server-side can share for consistency, sometimes I'll have empty strings. This fixed it, just changing the regex to
|
In sass you can define variable with path inside, like this $path: "/some_path/" and it will work.
When I'm moving such variables in the json file, sass compiler fails with error like this:
Warning: Syntax error: Invalid CSS after "/": expected expression (e.g. 1px, bold), was ""
for json:
{ root: "/" }
Is there a way to achieve loading such variables?
The text was updated successfully, but these errors were encountered: