将多个CSS文件合并为一个 [英] Concatenate multiple CSS files into one

查看:110
本文介绍了将多个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.

这篇关于将多个CSS文件合并为一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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