-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
read-only cache directory #226
read-only cache directory #226
Comments
Hi, Docker should has no impact. Once you used I can't say much more as I have no idea of what you do in your build. Note than we use file paths to match templates to cached files. So you must build them in the same machine and folder you read them on run-time, you can't create them then move or upload your cache directory. |
I totally overlooked the After some digging around, i resolved the slow pre caching (xdebug was enabled in the container which is used for generating the cache). The read-only cache thing is still not working for me and im kinda confused how this works: https://github.com/phug-php/phug/blob/master/src/Phug/Optimizer.php#L183 i don't see how
Any suggestions? Is this a bug? should i provide more information? |
From what i can see, a read-only cache without source templates is not possible. When the option I added this line: $cachePath = rtrim($this->cacheDirectory, '\\/').DIRECTORY_SEPARATOR.$this->hashPrint($file).'.php'; after https://github.com/phug-php/phug/blob/master/src/Phug/Optimizer.php#L157 and it works for me. In my case, |
It's not, it's passed by reference toi be set from inside And I agree it makes sense to also set this variable inside the I'm in a big process of converting Phug into a mono-repository with synchronized version and releasing the v 1.0 of all the packages. I will fix that right after that. |
Seed $cachePath passed by reference variable if requested by the user even if up_to_date_check is false Fix pug-php/pug#226
Here is the fix planned for phug/phug 1.0.1: So using pug-php, a simple |
Seed $cachePath passed by reference variable if requested by the user even if up_to_date_check is false Fix pug-php/pug#226 split: f986747ee4ffe17addedd06b667bd3ab35892fc7
Seed $cachePath passed by reference variable if requested by the user even if up_to_date_check is false Fix pug-php/pug#226
Seed $cachePath passed by reference variable if requested by the user even if up_to_date_check is false Fix pug-php/pug#226 split: f667a6bab863a347b764ff4d94eb388c22330f5e
1.0.1 released, please try to upgrade. |
i tried, but the version requirement of pug-php/pug prevents it:
|
Oh yes, I must publish a minor of pug-php/pug. |
Published, you can remove phug/* dependencies from your composer.json and simply run |
i upgraded with I checked, and both, the Did something change in this regard? |
Yes, you need to recompile the cache directory. I will do a showcase. |
- Usage of `pug compile-directory` CLI command - Usage of Optimizer facade and up_to_date_check to false and cache set
Here is a test to show how to use the CLI and the Optimize together: |
can you delete the *.pug files after caching, just to make sure the cached version is used? |
Maybe I can normalize the paths using a pure string calculation so the file does not need to exist. |
The error stack trace go to the compiler and the optimizer purpose is to skip it completely. So it's worst than I thought. |
|
It's been a while, i hadn't much time to check back on this. Was that the bug? Is it fixed now? I'd like to test it again and hopefully get it working. @kylekatarnls Btw, let me know with what you guys need help with. I'd be glad to dedicate some spare time to help out with anything to improve this project in the long term. Even if it's only just testing and finding weird bugs :D |
As you may see, I sent commit to the PR #228 just yesterday and I'm working on it right now. It's not that easy. Most of the work has to be done in phug/compiler and phug/renderer and we need to handle mutiple directories and multiple extensions, for example: $pug = new Pug([
'paths' => ['./vendor/views', './app/views'],
'extensions' => ['.pug', '.view'],
]);
$pug->renderFile('my-page'); There, the compiler will try the following paths:
And returns the first one found. So I'm considering multiple possibilities:
|
pug-php/pug#226 split: dd34c943141b80f986ac4768a967a16b65e8f9b1
pug-php/pug#226 split: dd34c943141b80f986ac4768a967a16b65e8f9b1
pug-php/pug#226 split: dd34c943141b80f986ac4768a967a16b65e8f9b1
pug-php/pug#226 split: 3f6cff3662aa0ba35ce891d86de8c41a335d55d4
pug-php/pug#226 split: 3f6cff3662aa0ba35ce891d86de8c41a335d55d4
pug-php/pug#226 split: 3f6cff3662aa0ba35ce891d86de8c41a335d55d4
pug-php/pug#226 split: 3f6cff3662aa0ba35ce891d86de8c41a335d55d4
This requested a lot of changes but phug-php/phug#49 should allow to remove view directories safely and even move the app directory once cached. See the unit test: |
You can now update then safely remove the view directory after caching. |
Hello,
im trying to trim down a docker production build which is using pug-php/pug 3.2.0
What i would like to do:
Current state:
Thanks!
The text was updated successfully, but these errors were encountered: