比较样式表 [英] Comparing stylesheets

查看:71
本文介绍了比较样式表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个50k的main.css文件,被一大堆网站引用。

这些网站中的每一个都有一个修改某些
main.css中定义的
样式。更改边框,方框等的颜色,

以及定义某些特定于网站的样式。 site.css很小

且易于理解,并且唯一可以由

质量编辑。


那就是理论。实践是,现在有4个站点在一周内生活

,其中一些声称理解css的muppet只是复制了

main.css在块中,重命名为site.css,调整了一些位并添加了

更多,而没有删除继承的样式(*很好的完整解释

以下)。这一切都运行正常,但这意味着每个网站的site.css现在是大约60k的
,当它意味着漂亮和整洁,大约10 / 20k。


所以,对于这个问题:

人们使用哪些工具可以帮助我?是否有任何

工具可以比较多个样式表中的声明到

阻止我坐下来费力地遍历每种风格

声明在网站.css检查它是否多余? 4次

结束?我已经看过Topstyle并且它似乎没有执行这个

函数,我觉得这很令人惊讶。我是傻瓜吗?


diff / sed / awk等都不是选择,顺便说一句......(我不是上帝)#



*晶莹剔透的解释:

在main.css中有这样的说法:


A.backtotop:link,A。 backtotop:访问{

浮动:正确;

保证金最高价:5px;

保证金权利:10px;

margin-left:7px;

padding-left:10px;

font-size:70%;

color:#fff;

背景:url(arrow_white_up.gif)0 0.6em不重复;

}

A.backtotop:hover {color:#fff ;}

在site.css中有这样的声明:


A.backtotop:link,A.backtotop:visited {

float:right;

margin-top:5px;

margin-right:0;

margin-left:7px;

填充左:10px;

字体大小:70%;

text-decoration:none;

颜色: #000;

背景:url(arrow_black_up.gif)0 0.6em不重复;

}

A.backtotop:悬停{text-decoration:underline; }

site.css不需要那些重复的声明,所以site.css *中的

声明应该*读取:


A.backtotop:链接,A.backtotop:访问{

margin-right:0;

text-decoration:none;

颜色:#000;

背景:url(arrow_black_up.gif)0 0.6em不重复;

}

A.backtotop :hover {text-decoration:underline; }

但是,就像,这些东西有240k ......

I''ve got a 50k main.css file that''s referenced by a load of sites.
Each of these sites also has a site.css file that modifies certain
styles defined in main.css. Changing the colour of borders, boxes etc,
as well as defining certain site specific styles. site.css is small
and easy to understand, and the only bit that can be edited by the
masses.

That''s the theory. The practice is that there are now 4 sites going
live
in a week where some muppet who claims to understand css has just
copied
main.css in chunks, renamed it site.css, tweaked some bits and added
more, without deleting the inherited styles (*nice full explanation
below). It all works fine, but it means each site''s site.css is now
about 60k, when it''s meant to be nice and neat and about 10/20k.

So, to the question:
What tools do people out there use that could help me? Is there any
tool that can compare declarations across multiple stylesheets to
prevent me from sitting down and laboriously going through every style
declaration in site.css to check if it''s redundant or not? 4 times
over? I''ve had a look at Topstyle and it doesn''t seem to perform this
function, which I find surprising. Am I being stupid?

diff/sed/awk etc aren''t options, btw...(I ain''t a unix god)


*Crystal clear explanation:
in main.css there is this statement:

A.backtotop:link, A.backtotop:visited {
float:right;
margin-top:5px;
margin-right:10px;
margin-left:7px;
padding-left:10px;
font-size:70%;
color:#fff;
background:url(arrow_white_up.gif) 0 0.6em no-repeat;
}
A.backtotop:hover {color:#fff;}
In site.css there is this statement:

A.backtotop:link, A.backtotop:visited {
float:right;
margin-top:5px;
margin-right:0;
margin-left:7px;
padding-left:10px;
font-size:70%;
text-decoration:none;
color:#000;
background:url(arrow_black_up.gif) 0 0.6em no-repeat;
}
A.backtotop:hover {text-decoration:underline; }
site.css doesn''t need those duplicate declarations, so that the
declaration in site.css *should* read:

A.backtotop:link, A.backtotop:visited {
margin-right:0;
text-decoration:none;
color:#000;
background:url(arrow_black_up.gif) 0 0.6em no-repeat;
}
A.backtotop:hover {text-decoration:underline; }
But, like, there''s 240k of this stuff...

推荐答案

" David" <哒******** @ yahoo.co.uk>在留言中写道

news:99 ************************** @ posting.google.c om ...
"David" <da********@yahoo.co.uk> wrote in message
news:99**************************@posting.google.c om...
我有一个50k的main.css文件,被一堆网站引用。
这些网站中的每一个都有一个修改某些网站的site.css文件。 />在main.css中定义的样式。更改边框,框等的颜色,
以及定义某些特定于站点的样式。 site.css很小且易于理解,并且是唯一可以由
群众编辑的。

这就是理论。实践是,现在有4个站点在一周内生活
,其中一些声称理解css的muppet刚刚以块的形式复制了
main.css,将其重命名为site .css,调整了一些位并添加了更多,而没有删除继承的样式(*下面的*完整的解释)。这一切都很好,但这意味着每个网站的site.css现在大约是60k,当它意味着漂亮和整洁,大约10 / 20k。

所以,对于这个问题:
人们使用哪些工具可以帮助我?是否有任何
工具可以比较多个样式表中的声明,以防止我坐下来并费力地浏览site.css中的每个样式
声明以检查它是否多余? 4次超过?我已经看过Topstyle并且它似乎没有执行这个功能,我觉得这很令人惊讶。我是傻瓜吗?
I''ve got a 50k main.css file that''s referenced by a load of sites.
Each of these sites also has a site.css file that modifies certain
styles defined in main.css. Changing the colour of borders, boxes etc,
as well as defining certain site specific styles. site.css is small
and easy to understand, and the only bit that can be edited by the
masses.

That''s the theory. The practice is that there are now 4 sites going
live
in a week where some muppet who claims to understand css has just
copied
main.css in chunks, renamed it site.css, tweaked some bits and added
more, without deleting the inherited styles (*nice full explanation
below). It all works fine, but it means each site''s site.css is now
about 60k, when it''s meant to be nice and neat and about 10/20k.

So, to the question:
What tools do people out there use that could help me? Is there any
tool that can compare declarations across multiple stylesheets to
prevent me from sitting down and laboriously going through every style
declaration in site.css to check if it''s redundant or not? 4 times
over? I''ve had a look at Topstyle and it doesn''t seem to perform this
function, which I find surprising. Am I being stupid?




如果您在muppet出现之前进行了备份,请从

备份中恢复文件。否则......


....如果你有Windows,你可以尝试从

回收站中恢复旧文件。



If you made a backup before the muppet showed up, restore the files from the
backup. Otherwise ...

.... if you have Windows, you can try to recover the old files from the
Recycle Bin.


David写道;
我有一个50k的main.css文件,被一堆网站引用。


太重了。

以下)。一切正常,但这意味着每个网站的site.css现在大约60k,当它意味着漂亮和整洁,大约10 / 20k。


更糟糕

所以,问题是:
人们使用哪些工具可以帮助我?是否有任何
工具可以比较多个样式表中的声明,以防止我坐下来并费力地浏览site.css中的每个样式
声明以检查它是否多余? 4次超过?我已经看过Topstyle并且它似乎没有执行这个功能,我觉得这很令人惊讶。我是傻瓜吗?

差异/ sed / awk等都不是选择,顺便说一下......(我不是上帝之神)


太糟糕了... Perl?...如果你找不到任何工具,它可能会花费很多时间来支付某人做这样的工具,所以下次这样的工作。如果我问这个问题,我肯定会成为一个工具......有些人知道了一些

CSS解析器会做出更好的工具。

。在main.css中有这样的陈述:

A.backtotop:link,A.backtotop:visit {
float:right;
margin-top:5px;
margin-right:10px;
margin-left:7px;
padding-left:10px;
font-size:70%;
颜色:#fff;
background:url(arrow_white_up.gif)0 0.6em不重复;
}
A.backtotop:悬停{color:#fff;}


简单的解决方案:回到顶部链接不是一个好主意,所以删除两个和

标记相关...

但是,就像,有240k这样的东西。 ..
I''ve got a 50k main.css file that''s referenced by a load of sites.
Too heavy.
below). It all works fine, but it means each site''s site.css is now
about 60k, when it''s meant to be nice and neat and about 10/20k.
Worse
So, to the question:
What tools do people out there use that could help me? Is there any
tool that can compare declarations across multiple stylesheets to
prevent me from sitting down and laboriously going through every style
declaration in site.css to check if it''s redundant or not? 4 times
over? I''ve had a look at Topstyle and it doesn''t seem to perform this
function, which I find surprising. Am I being stupid?

diff/sed/awk etc aren''t options, btw...(I ain''t a unix god)
Too bad... Perl?... If you can''t find any tool, it might made sence to
pay someone to do such tool, so next time such exsist. If I ahd this
problem, I would certainly make a tool... Someone with knowledge of some
CSS parser would make better tool.
in main.css there is this statement:

A.backtotop:link, A.backtotop:visited {
float:right;
margin-top:5px;
margin-right:10px;
margin-left:7px;
padding-left:10px;
font-size:70%;
color:#fff;
background:url(arrow_white_up.gif) 0 0.6em no-repeat;
}
A.backtotop:hover {color:#fff;}
Easy solution: Back to top links are not good idea, so delete both and
markup related...
But, like, there''s 240k of this stuff...




嗯,如果我说得对,你有4个site.css,你需要得到普通的

他们到main.css?或者你有什么具体的理由来

只是从site.csses中删除main.css中的东西?


-

Lauri Raittila< http://www.iki.fi/lr> < http://www.iki.fi/zwak/fonts>



Hm, If I got you right, you have 4 site.css, and you need to get common
stuff out of them to main.css? Or do you have some specific reason to
just remove stuff in main.css from site.csses?

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>




" Lauri Raittila" < LA *** @ raittila.cjb.net>在留言中写道

新闻:MP ************************ @ news.individual.ne t ...

"Lauri Raittila" <la***@raittila.cjb.net> wrote in message
news:MP************************@news.individual.ne t...
简单的解决方案:回页首链接不是一个好主意,所以删除两个和
标记相关...
Easy solution: Back to top links are not good idea, so delete both and
markup related...




那个''我第一次看到这个意见。为什么他们不是个好主意?



That''s the first time I''ve seen that opinion. Why aren''t they a good idea?


这篇关于比较样式表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆