Manipulate a css file

Hello

Is there a way to edit,add, delete selectors from a css file using the API?

Currently i am doing opening the content to a local var and then trying to find the property and to change the value using the following:

const entries = await pluginFolder.getEntries();
  const myDefCss = await pluginFolder.getEntry("Default.css");
  const myDefCsscontent = await myDefCss.read();
  var assets = require("assets");
  var allColors = assets.colors.get();
  allColors.forEach(element => {
    console.log(element.name);  
    if (element.name = "Header Background")
    {
      var n = myDefCsscontent.search("--header-background");
      console.log(n)
    }
  });

But it doesn’t sound like a good aprouch is there other way to do this?

Thanks in advance!

Yes, that seems like the wrong approach. There’s no clear way to prod UXP to re-read your changed css files.

Better to just modify your UI’s CSS styles dynamically, no?

Yes! that’s what I have ended up doing! many thanks…