Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Even if minify=false, it uses minified file #39

bitliner opened this Issue Sep 16, 2013 · 2 comments


None yet
1 participant

My conf is like this:

var cachify = require('connect-cachify') app.use(cachify.setup( getAllWithPublicAsRoot() , { root: path.join(__dirname, 'public'), production: false }));
where getAllWithPublicAsRoot returns an object like:

{ "/js/files.min.js":['/js/file1.js', '/js/file2.js'] }
where js folder is in public folder.

But if I see the html code in the page, it puts in the html /js/files.min.js, not the corresponding files specified in the corresponding array.

I'm using connect-cachify 0.0.15

Does anybody has the same problem?

I found my problem. Specifically:

  • files specified in assets field (e.g. app.use(assets,{}) )start all with the prefix static/ (the folder 'static/' is in the root of the project; I did it for the integration with tools of minification, like grunt-uglify)
  • the path specified in tag cachify('<path>') starts without the prefix static/, because the server serves static files directly from the static folder static/ (so if the file in assets field is specified like 'static/file1.js', the path in the views the server serves is '/file1.js' )
  • for this mismatching the method prod_or_dev_tags was failing in creating the right tags for the asset files

I solved adding in the options object a field myprefix. In this way the method prod_or_dev_tags can always understand how to serve properly asset files.

I didn't use the option url_to_paths because I had to specify too much stuff.

If it's worth to be integrated with the master repository let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment