[英]Compile many SCSS files in one CSS file in PHP
I try to compile my SCSS files with the following script: 我尝试使用以下脚本来编译我的SCSS文件:
use Leafo\ScssPhp\Compiler;
...
$scss = new Compiler();
$scss->addImportPath('/home/vagrant/Code/myapp/storage/app/scss/');
$cssContent = $scss->compile('@import "style.scss";');
The file style.scss has the following content: 文件style.scss具有以下内容:
////
/// Main Stylesheet
/// this file holds includes all files for the stylesheet
////
// a cleaner way to to breakpoints/media queries
// @source
// http://breakpoint-sass.com/
@import "breakpoint-sass/stylesheets/breakpoint";
// Helpful mixins
// @source
// http://bourbon.io/docs/
@import "bourbon/app/assets/stylesheets/bourbon";
// set default variables
@import "generic/variables/*";
// override default variables and set custom variables
@import "custom/generic/variables/*";
// generic - do not customize this files!
// files are generic and can be updated from base theme
@import "generic/*";
@import "vendor/**/*";
@import "objects/**/*";
// run through stuff in source folders, just patternlab stuff
@import "../source/**/*.scss";
// custom modifications
@import "custom/**/*";
The compiled css looks like: 编译后的CSS看起来像:
@import "breakpoint-sass/stylesheets/breakpoint";
@import "bourbon/app/assets/stylesheets/bourbon";
@import "generic/variables/*";
@import "custom/generic/variables/*";
@import "generic/*";
@import "vendor/**/*";
@import "objects/**/*";
@import "../source/**/*.scss";
@import "custom/**/*";
So, the compiler compiled only the file style.scss, but did not import any of the files, which should be imported. 因此,编译器仅编译了文件style.scss,但未导入任何应导入的文件。
I tried to add all the imports manually, like: 我尝试手动添加所有导入,例如:
$cssContent .= $scss->compile('@import "bourbon/app/assets/stylesheets/bourbon";');
$cssContent .= $scss->compile('@import "generic/variables/*";');
But it adds just the following two lines to the CSS code: 但它仅将以下两行添加到CSS代码中:
@import "bourbon/app/assets/stylesheets/bourbon";
@import "generic/variables/*";
use sccs.inc.php
使用sccs.inc.php
for More details Visit http://leafo.net/scssphp/ 有关更多详细信息,请访问http://leafo.net/scssphp/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.