-
Notifications
You must be signed in to change notification settings - Fork 132
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
JS_Pipeline and CSS_Pipeline hash error when using either roots-contentful or roots-records extensions #661
Comments
Hm, this is interesting. I can see why this has never been files before, usually hash is used only in |
I was testing a production compile. Emulating what would happen when my
|
Ok, I'll dig into this a little further today! |
Not sure if this is the same issue or not, my app.staging.coffee is
when run The contents of foot.jade are
this works just fine without hash option. But with hash option, the html is Tried removing the records require (which don't have configured yet anyway), but same behavior. Currently using Roots 3.1.0 as per #655 there are some issues with latest release. |
Are there any updates or workarounds for this issue? I'm using roots 4.0.1 and roots-records 0.5.1 and this issue is preventing me from using this in production. Would be great to have a fix or workaround for this. |
Not at the moment, I haven't had a chance to fix it yet. I'll take a look as soon as I can. Does this still happen if you just run |
Yes, this happens when I run
Thanks for looking into this. I'm deploying to Netlify now which offers its own postprocessing options, which I'm using for the generation of hashes now. This allows me to set the hash option in roots to false as a workaround for this issue. |
I'm experiencing a very similar issue but with the use of the It's a very small site with only 2 pages. When I disable the Worth noting that the issue seems to happen only with the last extension of either The |
I might cross-post this to roots-i18n? I didn't build this extension so I can't say I really am super familiar with its internals... |
It is quite simple, the relevant part seems to be this:
For every language, the extension will create an object in the form Nothing very esoteric... this observation combined with the other observations on the current issue seem to lead to something happening in Roots rather than in specific extensions. |
Thanks for the analysis here -- you definitely might be right. I don't really have the time to resolve this myself, but if you are willing to jump in and work on a patch I'd be happy to advise! |
I had a deeper look and I might have an idea of what's going on but still can't pinpoint where the exact origin would be. Here's what I think is happening... maybe this combined with your 'insider look' might help progress the issue. Looking at the code of The bulk of the pipeline's processing when using minification and hashing is done in After combination and minification (a relatively lengthy process) the new file name is computed to add the MD5 hash. Only then is I believe the issue lies in the fact that the js() method that is made available to templates reads the Now the issue seems to show up only when we add specific extensions. These extensions are all extensions that seem to fiddle with views ( |
Reading the documentation of the That would break the benefits of parallel processing for simple cases so maybe their respective I'll try to experiment with this avenue and report back... |
OK I had consistent success with returning But I fear that the issue at hand might be uncovering somewhat of a design flaw in the way Roots processes files in parallel... Let me know your thoughts! |
@davidmarquis sounds good! I don't think it's really a significant issue, to be honest. The thing is, it's extremely rare that roots users actually use the hashing, since deployment services like netlify, which are entirely free and interop very fluidly with roots, handle this for you. Roots has been stable for years, and used to build thousands of sites, and while a small number of people have run into this hashing issue, they all typically solve it by flipping off hashing and using netlify for hosting. That being said, roots at the moment is on a feature freeze in favor of spike, which we are using and actively developing going forward. So if you have been able to work out this issue, I think it's ok going forward. That being said, really appreciate the super thorough bug report and subsequent investigation -- not many people are willing to go that far and typically just ask me to solve the problem for them, so I really appreciate your taking the initiative! |
Ah crap, had I known that spike existed I would've used it for my project! :) I'll have a look... Happy to help! |
@davidmarquis ah yeah we haven't really pushed any publicity on it yet, but we will sometime soon! it's still production ready and widely in use 😉 |
Okay, so this is happening on Windows (10 but occurred on 8.1 too). I have no idea if the same problem exists on other platforms.
There are really two outcomes that occur when using the hash:true on each of the pipeline extensions and using either roots-contentful or roots-records configured to produce single-pages from data.
The first outcome
Functionally both dynamic content extensions work okay in that they produce pages based on a template and dynamic data sourced from the net. The issue stems from the compile timing of those generated pages and their use of a layout that uses != js() and != css() to render the outputs of js_pipeline and css_pipeline respectively.
Whilst normal jade templates referencing the layout will show hashed script and css file references, the single pages (from the dynamic extensions compilation) still show the non-hashed filename, as defined by the out parameter of the pipeline extension.
The second outcome
The hashing function in each pipeline method is executed multiple times resulting in the out file containing multiple hash numbers separated by a dot. E.g.:
This filename is the used in the non-dynamic pages like so:
This only occurs when using the dynamic content extensions and I am assuming because the outputs of each extension is not synchronized.
The text was updated successfully, but these errors were encountered: