开发者

Generate a CSS file from HTML markup

开发者 https://www.devze.com 2023-03-28 18:54 出处:网络
I create a lot of html and css pages. Is there a way to markup an html file, than generate a css file from the markup.

I create a lot of html and css pages. Is there a way to markup an html file, than generate a css file from the markup.

Here's what i'm thinking:

Example Markup

<body id="home">
   <section id="main">
       <article>
           <p>Some content</p>
       </article>
   </section>

   <aside>
       <article>
           <p>Some more content</p>
       </article>
   </aside>
</body>

Example of gen开发者_运维问答erated CSS

#home {  }
#home #main {  }
#home #main article {  }
#home #main article p {  }

#home aside {  }
#home aside article {  }
#home aside article p {  }


Yes, there is: parse the HTML and walk the DOM tree to generate your skeleton CSS file.

PS: that IS very impractical CSS.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号