Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.

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

Open
bitliner opened this issue Sep 16, 2013 · 2 comments
Open

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

bitliner opened this issue Sep 16, 2013 · 2 comments

Comments

@bitliner
Copy link

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

@bitliner
Copy link
Author

Does anybody has the same problem?

@bitliner
Copy link
Author

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant