Home >Web Front-end >CSS Tutorial >Detailed explanation of the technique of forcing CSS to be packaged into a single file in the Less framework

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

高洛峰
高洛峰Original
2017-03-08 13:49:241633browse

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;   
}

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

a{   
    color:red;   
}   
p {   
  color: yellow;   
}

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

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

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!

Statement:
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