I'm building a web app, just like CodePen or something like that. It offers user to input code and run in browser.
My problem is, I got a css text string from user input, and in order to limit the css scope. I need to add an extra selector (i.e. #user-css
) before every css rule.
In other words, it's just a string manipulation, But there maybe have @keyframes
, @media
or comment, etc to avoid.