edgecase / dieter

Asset pipeline ring middleware
134 stars 22 forks source link

Recompiling on reach request #55

Open kendagriff opened 11 years ago

kendagriff commented 11 years ago

In production it's recompiling the assets with each request:

(def asset-config-options {:engine :v8
                           :compress true
                           :cache-mode :production
                           :asset-roots ["resources"]
                           :cache-root "resources/asset-cache"
                           :log-level :normal})

The timestamp changes with each request. I'm using link-to-asset as instructed.

Am I missing something?

kendagriff commented 11 years ago

Reverting to 0.3.0 seems to fix the problem.

pbiggar commented 11 years ago

What filename was in the link-to-asset, and what filenames existed on the system? Is this the same problem from https://github.com/edgecase/dieter/issues/9#issuecomment-20239190? If so, I think we should look at a documentatin fix.

kendagriff commented 11 years ago

Okay, I don't believe this is related to #9. Even with a patched version of 0.4.0, Dieter with cache-mode set to :production recompiles CSS and JS on each request.

FYI: I'm not precompiling, just having it compile at run time.

kendagriff commented 11 years ago

Is it possible this is also fixed in the master branch?

pbiggar commented 11 years ago

I intended :production to be used with precompilation - I didn't consider that it might compile once and cache. I think.

I'll definitely take a patch for this. Thanks!

kendagriff commented 11 years ago

Ah, that makes sense. I think precompilation is the better long-term solution for most projects anyway.

Perhaps its behavior is simply worth documenting. Many of us (me included) come from Rails' asset pipeline, which, if it cannot find cached assets in production at runtime, it makes them.

I'm still too unfamiliar with Dieter's internals, so I'd be happy to document the behavior, and perhaps submit a patch when I can navigate the code a bit better...

kendagriff commented 11 years ago

I don't mean to be such a pest; I'm just struggling to understand the workflow.

I set cache-mode to :development, nothing is precompiled to the cache, as expected. I run lein dieter-precompile, however, and no files are generated. It runs, but nothing is generated and placed into the cache-root as the documentation states. No errors, nuthin'.

If I change cache-mode to :production, it does generate precompiled files, and stashes them in cache-root. But, as I mentioned earlier, it will regenerate the files with each request.

There's either a bug, or I'm missing something simple. I'd be happy to patch up documentation for other noobs like me.

pbiggar commented 11 years ago

Can you post your dieter-options? Do you have :precompiles specified?