How to parse css (stylesheet) comments (annotations)?

I have this idea, the user defines a set of css rules with some comments (comments are simple annotations):

/* @name Page style */
body {
   font: 16px/1.5 Arial; /* @editable */
   backgorund-color: #fff; /* @editable */
}

/* @name Section header */
h1 {
   font: 20px/1.2 Arial; /* @editable */
   color: #c44 
}

I can apply this stylesheet to my page, but I also want to parse these rules with comments and provide some forms for editing these styles and allow the user to change styles on the fly. These comments will indicate which rules / properties are editable.

I was looking for some solution for browser or server. The simplest serwer solution is to parse this css using some java css parser, convert it to ex. json and then use that json in the browser: http://www.featureblend.com/css-json.html

, Java- Java css, .

, css. , ?

+3

Source: https://habr.com/ru/post/1755486/


All Articles