4

I'm trying to create a share css style rule for my lwc components following the doc and it doesn't work

I created a LWC component like this

myStyle 
  --myStyle.css
  --myStyle.js-meta.xml

myStyle.css

:host() {
   --my-color: red; 
}

myStyle.js-meta.xml

<?xml version="1.0" encoding="UTF-8" ?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>49.0</apiVersion>
    <isExposed>false</isExposed>
</LightningComponentBundle>

But when I tried to deploy this, I see this error

Error force-app/main/default/lwc/myStyle/myStyle.js-meta.xml No base file for markup://c:myStyle

And it deletes my files!!!

I added the Javascript and HTML files and when I tried to import the css module in another component I get this error: Unknown ref type slds for ref c/myStyle in file..

The doc also it's not very clear. What is the difference between the lwc component described in step 1 and the component in step 2?

https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.create_components_css_share

  • Did you find a solution to this ? – Shamina Jul 29 at 14:30
0

The problem was fixed in newer versions. After Summer ’20 is working

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.