Add an option to update cached files #9

Closed
wants to merge 2 commits into from

2 participants

@fnordfish

Hi Kelly,

I've added an option to enforce the update of cached css files on each request.
Certainly, this is nothing you want to use in production. Here is how I'm using it:
For very small projects, we don't want to have less files compiled in production environments. So we simply check in the compiled css files and deploy those. Using rack-less and let it recreate the cache files spares us an extra tool to do the job.

Regards
-Robert

@fnordfish fnordfish new option enforcing cached files to be updated
overwrite the cached file if caching is enabled and the 'update_cache' option is set
74226bd
@fnordfish

well, that does not get it yet in real live.
the purpose is, to generate the cached file into the default public/stylesheets in order to get it served with non-rack-less production environments.

@kellyredding
Owner

@fnordfish - let me restate what you are asking for and make sure I understand what you are wanting.

  • you generate compiled css files and check them into source control
  • you want to have those regenerated on every request so that as you are developing them new files are being written and you can check in the updates
  • right now, you can't tell rack-less to regenerate the files on every request, because when it generates the files, it just uses the ones previously generated.

Is that a correct description of the problem?

The only weird issue I see is that if you are writing files to public/stylesheets, how do you make it so your development env won't pick those up? Once stylesheets are generated there, I don't think requests for them even hit the rack stack? Am I correct?

@fnordfish

@kelredd that's exactly what I was asking.
The thing is, that rack itself does not prefer static files unless you use Rack::Static.
So basically, if the request gets to your thin/webrick/whatever and is not redirected by some proxy (varnish/nginx/apache/...) this will hit rack. After that, it depends on the execution order of rack middle-wares.

@kellyredding kellyredding added a commit that referenced this pull request Dec 9, 2011
@kellyredding in response to #9:
* respond to the request even if the file has been cached.
e11f9c4
@kellyredding kellyredding referenced this pull request Dec 9, 2011
Merged

in response to #9: #10

@kellyredding

Closing in favor of solution in #10.

@kellyredding kellyredding added a commit that referenced this pull request Dec 10, 2011
@kellyredding version to v3.0.2
* better cache behavior (#10/#9)
* when caching, rack-less will always respond and re-cache (whether a cached file for the request exists or not)
56d8770
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment