Detailed explanation of the technique of forcing CSS to be packaged into a single file in the Less framework

高洛峰
Release: 2017-03-08 13:49:24
Original
1583 people have browsed it

When using the Less precompiled framework, we always hope to efficiently manage the deployment structure of CSS files. Here we will look at a technique for forcing CSS to be packaged into a single file in the Less framework. Friends who need it can refer to it.

less will merge other less files into a single file when importing them.
But when introducing a css file, the css will not be merged by default.
Use the inline keyword to force a.css to be packaged into the final single file:

@import (inline) "./a.css";   
p{   
  color:yellow;   
}
Copy after login

The compiled result is as follows, there is only one file (a.css has only one a Style)

a{   
    color:red;   
}   
p {   
  color: yellow;   
}
Copy after login

If there is no inline parameter, the final result is as follows, two files will be requested

@import "a.css";   
p {   
  color: yellow;   
}
Copy after login

The above is the detailed content of Detailed explanation of the technique of forcing CSS to be packaged into a single file in the Less framework. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!