Skip to content

LWC css import Static Resource css #2279

Open
@KelvinHuangDZ

Description

@KelvinHuangDZ

Hi, is there a way my lwc css can @import a Static Resource css?
I have a lwc that is both available in the sf community and sf record page. I have build all my community custom css and saved all in the Static Resource. When I drop this lwc into the sf record page, I wish to apply the custom css to this component only. I have tried to use loadStyle in the js, but it's apply the css to the global level. Is there a way this lwc css can ref to the custom css in the Static Resource?

I tried:
@import url('/resource/xxx/main.css')
or
@import url('@salesforce/resource/xxx/main.css');
Getting invalid import statement, unable to find imported module.

Is there anywhere we can requested this feature? This should be standard css rules.
https://developer.mozilla.org/en-US/docs/Web/CSS/@import

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    External: Other SalesforceCategorizes issue or PR as related to Salesforce related features.Native ShadowBugs & Feature Requests that will be unlocked by supporting native shadow

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions