Include/import uss files inside uss files

My USS file is getting quite long. Does USS support includes, like:

@import url("filename.uss");

I can’t get it working, but I also don’t get error messages.

Perhaps I am using USS in an unintended way, if so do let me know. I found it simplest to import a single file at EditorWindow.OnEnable and add it to the root element instead of specific elements.

This feature is not supported and should indeed give you an error, or at least a warning.

Ok. No warning or error though.

I know this thread is a couple years old, but for anyone coming from the web like myself, and to @cecarlsen if you’re still looking:

You can use multiple stylesheets in a single .uxml definition, like in the image below
8123237--1053035--upload_2022-5-12_11-22-44.png

It may not be your original ask, but there is also a .TSS theme file where you can specify multiple icons and stylesheets to create a theme. I would love to point you to a documentation page on how to use it but I am trying to find out myself in this thread:

Small update, good news the USS import feature is now supported.
I’m not entirely sure in which release it was added.

5 Likes

Great, thanks for the update @jonathanma_unity ! I’ve noticed that there are two ways one can import an USS file into another - @import url("filename.uss"); and @import "filename.uss";. Is there a reason why one would chose former over the latter, or vice versa?

1 Like

Gotta bump this before the thread gets locked.

It… (probably) doesn’t matter, really. Both do the same thing.