将多个CSS文件合并为一个

问题描述:

将多个CSS文件连接成一个CSS文件的最佳方法是什么?

What is the best way to concatenate multiple CSS files into one CSS file?

我想减少以下内容。

<link href="css/1.css" rel="stylesheet" type="text/css" media="all">
<link href="css/2.css" rel="stylesheet" type="text/css" media="all">
<link href="css/3.css" rel="stylesheet" type="text/css" media="all">

.. into ..

.. into ..

<link href="css/1-3.css" rel="stylesheet" type="text/css" media="all">

只需执行 cat css / *。css> css / 1-3.css 似乎没有做到这一点。

Simply doing cat css/*.css > css/1-3.css does not seem to do the trick.

cat 的参数的 ordering 匹配HTML文件中的三个引用的CSS文件的原始顺序 cat -method应该按预期工作。

As long as the ordering of the arguments for cat matches the original ordering of the three referenced CSS files in the HTML file the cat-method should work as expected.

所以说..

<link href="css/one.css" rel="stylesheet" type="text/css" media="all">
<link href="css/two.css" rel="stylesheet" type="text/css" media="all">
<link href="css/three.css" rel="stylesheet" type="text/css" media="all">

..以下conaternation ..

.. the following concaternation ..

cat css/one.css css/two.css css/three.css > css/all.css

..一起将会有以下引用..

.. together will the following reference ..

<link href="css/all.css" rel="stylesheet" type="text/css" media="all">

..应该是100%完全相同。

.. should be 100 % identical.