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

Caching problems #7

Closed
greew opened this issue Nov 11, 2021 · 2 comments
Closed

Caching problems #7

greew opened this issue Nov 11, 2021 · 2 comments

Comments

@greew
Copy link
Contributor

greew commented Nov 11, 2021

After having upgraded from 1.0.9 to 1.5.1, the caching no longer works as expected.

As an example - I have three files:

# a.scss
@import 'b';
@import 'c';

body {
    height: 100%;
}

# b.scss
body {
    height: 100%;
}

# c.scss
body {
    height: 100%;
}

This produces the following metafiles

# Version 1.5.1
a:3:{s:4:"etag";s:32:"601fc4bcc19b878a97a57ae8927cd4e5";s:7:"imports";a:2:{s:33:"/var/www/css/theme/othello/b.scss";i:1636627636;s:33:"/var/www/css/theme/othello/c.scss";i:1636627636;}s:4:"vars";i:2723407904;}

# Version 1.0.9
a:3:{s:4:"etag";s:32:"ce69e5d65310f5daaec2885e5d070987";s:7:"imports";a:3:{s:33:"/var/www/css/theme/othello/a.scss";i:1636627636;s:33:"/var/www/css/theme/othello/b.scss";i:1636627636;s:33:"/var/www/css/theme/othello/c.scss";i:1636627636;}s:4:"vars";i:2723407904;}

The version 1.0.9 also includes the a.scss file, but version 1.5.1 does not.

I can see that when

'imports' => $this->makeParsedFilesFromIncludeFiles($result->getIncludedFiles()),
changed from $this->scss->getParsedFiles() to the current version, the original file isn't anymore a part of the returned filed.

I'd like to help and mostly need to know, whether the line https://github.com/scssphp/scssphp/blob/eba0633bf8a527738d2aca210b4a0cb182599c5d/src/CompilationResult.php#L54 ought to also include the originally parsed file, or if we should add it manually in this repository?

Best regards
/Jesper

@greew
Copy link
Contributor Author

greew commented Nov 11, 2021

After thinking it even more through, maybe we can fix it by changing

'imports' => $this->makeParsedFilesFromIncludeFiles($result->getIncludedFiles()),
to

 'imports' => $this->makeParsedFilesFromIncludeFiles(array_merge([$in], $result->getIncludedFiles())), 

@dleffler
Copy link
Contributor

dleffler commented Jan 5, 2022

that solution probably also needs to be included in the other getIncludedFiles() call in the compileFile() function.

dleffler added a commit to dleffler/server that referenced this issue Mar 1, 2023
1. Add missing @throws to function comments
2. Adds sourcemap element to array returned by compileFile() since the sourcemap must now be saved by calling program
3. Adds current file to list of files returned by compile() and compileFile(), Issue scssphp#7
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

3 participants