Hi all,
I'm trying to reproduce this code example to customize a shiny for pyhton theme. Here is what I did:
First, I installed libsass using
pip install libsass
Then, I created the my_theme.py file as shown in the example and tried to run the script but I ran into this error:
Traceback (most recent call last):
File "c:\Users\tl100\PycharmProjects\shiny_amulator\development\theme_freecastle.py", line 19, in <module>
f.write(my_theme.to_css())
^^^^^^^^^^^^^^^^^
File "C:\Users\tl100\.conda\envs\shi\Lib\site-packages\shiny\ui\_theme.py", line 430, in to_css
self._css = sass.compile(string=self.to_sass(), **args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tl100\.conda\envs\shi\Lib\site-packages\sass.py", line 725, in compile
raise CompileError(v)
sass.CompileError: Error: File to import not found or unreadable: C:Userstl100.conda♫nvsshiLibsite-packagesshinywwwsharedsasspresetshiny_01_functions.scss.
on line 1:1 of stdin
>> @import "C:\Users\tl100\.conda\envs\shi\Lib\site-packages\shiny\www\shared\s
^
And indeed, the path that could not be found or read looks really strange. So, I tried to paste the absolute path into the _theme.py
file:
def to_sass(self) -> str:
"""
Returns the custom theme as a single Sass string.
Returns
-------
:
The custom theme as a single Sass string.
"""
# path_functions = path_pkg_preset(self._preset, "_01_functions.scss")
path_functions = "C:/Users/tl100/.conda/envs/shi/Lib/site-packages/shiny/www/shared/sass/preset/shiny_01_functions.scss"
path_defaults = path_pkg_preset(self._preset, "_02_defaults.scss")
path_mixins = path_pkg_preset(self._preset, "_03_mixins.scss")
path_rules = path_pkg_preset(self._preset, "_04_rules.scss")
However, I get the same issue:
Traceback (most recent call last):
File "C:\Users\tl100\PycharmProjects\shiny_amulator\development\theme_freecastle.py", line 19, in <module>
f.write(my_theme.to_css())
^^^^^^^^^^^^^^^^^
File "C:\Users\tl100\.conda\envs\shi\Lib\site-packages\shiny\ui\_theme.py", line 430, in to_css
self._css = sass.compile(string=self.to_sass(), **args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tl100\.conda\envs\shi\Lib\site-packages\sass.py", line 725, in compile
raise CompileError(v)
sass.CompileError: Error: File to import not found or unreadable: C:/Users/tl100/.conda/envs/shi/Lib/site-packages/shiny/www/shared/sass/preset/shiny_01_functions.scss.
on line 1:1 of stdin
>> @import "C:/Users/tl100/.conda/envs/shi/Lib/site-packages/shiny/www/shared/s
^
Yet, the path looks different but still could not be accessed. I also tried to customize a shinyswatch theme using this approach:
import shinyswatch
(
shinyswatch.theme.zephyr
.add_defaults(
primary="#aa00ff", # purple
secondary="#bfff00", # lime green
)
.add_rules(
"""
strong {
color: $primary;
}
"""
)
)
But I run into the same error.
Does someone of have an idea of what else I could do? Please let me know if you need further information. I appreciate any help, thanks