Import paths
You can define custom import paths, the compiler will look in those folders if it can't find an import in the current folder :
$compiler = new Compiler([
'publicFolder' => '/absolute/path/to/public/folder',
'importPaths' => [
'my/folder',
'my/other/folder'
]
]);
//Or
$compiler
->appendImportPaths('my/folder')
->prependImportPaths('my/other/folder');
The compiler will resolve imports according to the folder structure of the current file and look into import paths by ascending order. An example that would work :
- folder1
- app.scss
- folder 2
- subfolder1
- imported.scss
$compiler = new Compiler([
'publicFolder' => '/absolute/path/to/public/folder',
'importPaths' => [
'folder2'
]
]);
$compiler->compile([
'app.scss' => 'cssFile1.css',
], 'folder1');
app.scss :
@import "subfolder1/imported.scss";
Import paths apply to the @import rule only, not to assets defined within url() functions.