Within my JavaScript code, I have a CSS string stored in a variable.
@import url('https://themes.googleusercontent.com/fonts/css?kit=OPeqXG-QxW3ZD8BtmPikfA');
o {
margin: 0;
padding: 0
}
table td,
table th {
padding: 0
}
.c2 {
margin-left: 7pt;
padding-top: 0pt;
}
.c3 {
color: #000000;
font-weight: 400;
}
My goal is to extract the CSS class and tag separately and format it as follows:
tagsStyles = {o: { margin:0, padding:0} }
classesStyles = { 'c2': { margin-left: '7pt', padding-top: 0pt,},'c3' : {color: '#000000',font-weight: '400'} }
Please note the use of inverted commas ''.
In essence, I am aiming to convert webpage styles into the style required for a particular npm package, which can be found at this link.
This npm package provides the styling functionality needed for this conversion process.