Manipulate a css file


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;
  var assets = require("assets");
  var allColors = assets.colors.get();
  allColors.forEach(element => {
    if ( = "Header Background")
      var n ="--header-background");

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…