Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load files from array? #707

Open
supun-io opened this issue Mar 11, 2024 · 3 comments
Open

Load files from array? #707

supun-io opened this issue Mar 11, 2024 · 3 comments

Comments

@supun-io
Copy link

Currently, the library reads from the file system. The idea here is to load @import files from a predefined set of strings.

$compiler = new ScssPhp\ScssPhp\Compiler();
$compiler->registerFiles([
     'index.scss' => '...',
     'page.scss' => '...',
]);

$compiled = $compiler->compileFile('index.scss');

This is useful in cases where the SCSS files are loaded from an external source like a database.

We already have this implemented in a fork (https://github.com/hyvor/scssphp), which we use in production. If this sounds like something worth adding to the library, I'd be happy to send a PR.

@stof
Copy link
Member

stof commented Mar 11, 2024

I don't want to add this in the 1.x branch (I don't want to add more new features there, especially introducing new APIs that I would have to deprecate later).

For 2.x (currently in progress and not available yet), the importer API should allow implementing such use case by using a custom importer.

@supun-io
Copy link
Author

Thanks! That makes sense. I'll be waiting for 2.x. Do you have a rough timeline? (no rush :))

@stof
Copy link
Member

stof commented Mar 13, 2024

I don't have any as I'm working on that on my free time (and these days, most of my free time is not dedicated to open-source)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants