CSS以JSON解析器或转换器 [英] CSS to JSON Parser or Converter
问题描述
我工作在一个非网络平台,没有HTML或CSS层,只是一个纯粹的JavaScript实现。
I'm working on a non-web platform with no HTML or CSS layer, just a pure JavaScript implementation.
我想加载使用AJAX CSS文件为文本字符串,解析CSS成JS对象或JSON,然后使用工具库间preT什么样的风格应该被应用到一个元素在DOM树。
I would like to load a CSS file as a text string using AJAX, parse the CSS into a JS objects or JSON, and then use utility library to interpret what styles should be applied to an element in the DOM tree.
我将如何做呢?
推荐答案
我认为你正在寻找一个JavaScript的CSS解析。
I think you're looking for a "JavaScript CSS parser".
你看其中任一?
http://www.glazman.org/JSCSSP/
或
<一个href="http://bililite.com/blog/2009/01/16/jquery-css-parser/">http://bililite.com/blog/2009/01/16/jquery-css-parser/
第一个看起来像一个不错的选择,但如果你像jQuery,那么也许你会preFER第二个。
The first one looks like a good fit, but if you like jQuery then maybe you'd prefer the second one.
心连心
这篇关于CSS以JSON解析器或转换器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!