compiler construction - How to compile nested css rules using javascript -


i need little making own css-compiler in javascript.

how can make compiler compiles nested rules example:

html{     background: #2e2e2e;     body{         height: 200px;         width: 100%;         background: #fff;         a{             color: rgb(0, 0, 255);             &:hover{                 color: rgb(200, 0, 255);             }         }     } } 

into this:

html{     background: #2e2e2e; } html body{     height: 200px;     width: 100%;     background: #fff; } html body a{     color: rgb(0, 0, 255); } html body a:hover{     color: rgb(200, 0, 255); } 

thanks help!

if vote down, please tell me why.

i start mentioning building own css-compiler no joke. serious thing. should use sass, less, or stylus. if missing feature need, should build plugin them, rather try implement own engine.

having said that, answer question may reworkcss. project people use make own css-compiler.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -