Most IDEs use the in-process convert method of the Asciidoctor project, and that will not return a header and footer. Without the header and footer the stylesheet information are lost.
One solution for this is to add a static header, and that might then miss the logic for the stylesheet attribute.
The AsciiDoc plugin for IntelliJ (that I currently maintain) re-adds the logic for the stylesheet for its custom header. See
https://intellij-asciidoc-plugin.ahus1.de/docs/users-guide/features/advanced/stylesheets.html for in-depth information on how to configure this.
Other plugins might need to do the same or similar things.
To gain more insight in this, I recommend you head over to the Zulip community that is more active than this forum, and will IMHO eventually replace this forum.
https://asciidoctor.zulipchat.com/login/