You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using compile(string='<sass content>') I get the following error: Invalid CSS after ""
But if I put that same SASS into a file and load it, the error disappears.
The output below describes this issue.
In [4]: sass.compile(filename='server/style.sass')
Out[4]: 'a b {\n color: blue; }\n'
In [5]: x = '''
...: a
...: b
...: color: blue
...: '''
In [6]: sass.compile(string=x)
---------------------------------------------------------------------------
CompileError Traceback (most recent call last)
<ipython-input-6-030bbd1c42f9> in <module>
----> 1 sass.compile(string=x)
/nix/store/p5qcpw0b0y290wdkw4dxwrs6c0m9nzk0-python3-3.9.9-env/lib/python3.9/site-packages/sass.py in compile(**kwargs)
736 raise TypeError('something went wrong')
737 assert not s
--> 738 raise CompileError(v)
739
740
CompileError: Error: Invalid CSS after "": expected 1 selector or at-rule, was "a"
on line 1:1 of stdin
>>
^
In [7]: with open('server/style.sass', 'r') as f:
...: print(f.read())
...:
a
b
color: blue
In [8]: sass.__version__
Out[8]: '0.21.0'
The text was updated successfully, but these errors were encountered:
The front page doesn't mention this, but I delved into stackoverflow and found a post stating that you must pass indented=True to compile.
This really should be on the front page, especially as the way the flask-style docs are generated, it's not obvious how to actually get to the API docs.
There's no API on the table of contents.
It's hidden down under "Module Index".
This is below about 40 different version links
Then external references, licensing, credits, and finally, Indices and Tables (which again doesn't say the words API).
The only reason I found this was because I noticed a large docstring for the compile function, but nothing I could see in the documentation.
I suggest:
Adding mention of the indented keyword being required for SASS passes as strings to the examples.
Providing links to the API in the left column rather than just external references. I'm using this library. References are not relevant.
Providing links to the API higher up that page. Anything after version information is generally superfluous.
Preferably the SASS/SCSS distinction would be automatically detected and this argument would not be required.
The code could re-try with indented=True and print a warning to the user.
Or the error could suggest trying indented=True if they didn't specify it and the error appears to be related to this.
Using
compile(string='<sass content>')
I get the following error:Invalid CSS after ""
But if I put that same SASS into a file and load it, the error disappears.
The output below describes this issue.
The text was updated successfully, but these errors were encountered: