-
Notifications
You must be signed in to change notification settings - Fork 141
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
Asset dependencies are not respected in render
plugin
#191
Comments
I agree this is a bug. We probably need the same type of code that the assets plugin uses, where you can pass an array of dependencies and it checks the mtime for all of them. Maybe we can pass the |
@jgarth Is this something you plan to work on in the near future? If not, I can work on it before the next release. |
Yes, I'd like to submit a PR over the weekend. However, if this is more urgent to you then by all means go ahead. |
That sounds great. The weekend should be fine. The next release isn't for a couple weeks. |
I plan to work on this shortly. |
I added a PR with what I currently have, but I failed to incept a proper spec for the changes to the asset plugin |
OK, thank you. I was working on a spec first, so once I have a failing spec, I can hopefully merge the PR and test that it fixes the issue. |
Hi Jeremy,
thanks for making & maintaining a really cool framework. I've found some unexpected behavior when rendering SCSS assets with dependencies.
Summary
When I change a dependent SCSS file, the rendered output does not reflect my changes.
Given this configuration
assets/css/checkout/index.scss
:assets/css/checkout/other.scss
:Expected behavior
Changes to
other.scss
should be reflected upon page reload.Actual behavior
Changes to
other.scss
are only reflected upon server restart, not before.Probable cause
Looking at https://github.com/jeremyevans/roda/blame/master/lib/roda/plugins/render.rb#L262,
the
TemplateMtimeWrapper
'smodified?
method has no clue about the template's dependencies (i.e.other.scss
), and as such always uses themtime
for the template file itself (i.e.index.scss
), instead of the highestmtime
of its dependencies. This leads to the template not actually being reloaded in line 270. This, in turn, means that the changes inother.scss
are not reflected when rendering.Changing the
render
function to always set@mtime = Time.now
at the beginning of the function produces the expected behavior, but I'm guessing this "disables" template caching altogether.I can submit a PR if you point me in the right direction for a fix.
Thanks!
The text was updated successfully, but these errors were encountered: