2021年3月20日星期六

CSS and PHP: @import vs php include

Currently, I have a file with all my styles like this:

<link rel="stylesheet" href="styles-1.css">  <link rel="stylesheet" href="styles-2.css">  <link rel="stylesheet" href="https://bootstrap-library-cdn-url-adresss.css">  

All this file is named "styles.php". Then, I call it to the HTML Head tag:

<head> <?php include 'styles.php' ?> </head>  

But what happen if instead of that, I create a "styles.css" file containing the following:

@import "style-1.css";  @import "style-2.css";  @import "https://bootstrap-library-cdn-url-adresss.css";  

Then call this to the head on regular basis:

<head><link rel="stylesheet" href="styles.css"></head>  

Paths to remote or local files are not relevant, I can check out. My concern is about if using php include could be more optimal than the second example. Orientation, please.

https://stackoverflow.com/questions/66727942/css-and-php-import-vs-php-include March 21, 2021 at 09:03AM

没有评论:

发表评论