Skip to content
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

Use of aggressive cache complicates custom development #148

Closed
petrdvorak opened this issue Aug 11, 2015 · 8 comments
Closed

Use of aggressive cache complicates custom development #148

petrdvorak opened this issue Aug 11, 2015 · 8 comments

Comments

@petrdvorak
Copy link

We would like to customize mixins and index page, but every-time we change something in the file, we need to manually clear the cache, since previous file versions are (quite aggressively) cached. It would be nice to add a command-line switch --no-cash (or --flush-cache) so that we can disable cache for the command (or clear the cache in advance).

@danielgtaylor
Copy link
Owner

@petr-inmite please try the latest release with the NOCACHE environment variable set. You can use BENCHMARK to see whether it is recompiling the templates each time:

NOCACHE=1 BENCHMARK=1 aglio -i input.apib -o output.html

@vghelich
Copy link

Setting NOCACHE environment variable disables caching of .js files only (but not .css files, for example). Is there any way to disable caching completely?

@danielgtaylor
Copy link
Owner

@vghelich are you sure? Please make sure you are using the latest version and set NOCACHE, then run with --verbose and it should say when it is loading from the cache or when it is generating the asset from scratch.

@vghelich
Copy link

Yes. Using [email protected] I get the following errors:

  1. without NOCACHE: Error: Could not get template: Error writing cached template file: EACCES, permission denied '/usr/lib/node_modules/aglio/node_modules/aglio-theme-olio/cache/f349087d9467d1db791bf4d8fe3b554c2dd562ac.js'

  2. with NOCACHE: Error: Could not get CSS: Error writing cached CSS to file: EACCES, permission denied '/usr/lib/node_modules/aglio/node_modules/aglio-theme-olio/cache/bb851236ef33e467631256487d5bbe519de24415.css'

I've globally installed aglio but installing it locally didn't help either.
Actually I don't mind the use of caching and the reason wanted it disabled was to get rid of the above errors.

@danielgtaylor
Copy link
Owner

@vghelich ah I think I understand this now. Using NOCACHE=1 just disables reading of the cache. The caches are still created in case you want to use them later, since the computationally intensive task of compiling the template or CSS is done anyway. It adds minimal overhead to write the file out to disk and then it can be used if you run without the NOCACHE option. It looks like what is happening for you is a permissions error while writing the cache. I would check the permissions to try and figure out what is going on.

@slurmulon
Copy link

slurmulon commented May 10, 2016

@danielgtaylor not to dig up a closed ticket, but I wanted to mention that I am suddenly experiencing a similar problem with the aglio-olio-theme, although I'm receiving a ENOENT issue (missing file/directory) instead of EACCES (bad perms). Using aglio 2.2.0:

Error: Could not get CSS: Error writing cached CSS to file: ENOENT: no such file or directory, open '/Users/adminaccount/Code/clint/ui/node_modules/blot/node_modules/aglio-theme-olio/cache/b0b0865f713b341beb7fe4b90d8e628262a88e6b.css'"

I was able to resolve this error by simply running the following:

mkdir node_modules/blot/node_modules/aglio-theme-olio/cache

The postinstall script for aglio-theme-olio could be updated to simply ensure the cache directory exists before the module is used. Alternatively you could check that the cache directory exists just before it's used, using something like mkpath - I personally prefer the latter approach as it prevents the build from getting crufty.

I also wanted to note that NO_CACHE will not resolve the issue here, which is clearly expected since this flag only prevents the reading of the cache, not the creation of it.

Happy to open an issue and accompanying PR if we agree on this issue.

@jeromeWeb
Copy link

+1

@jkryanchou
Copy link

+1 Please to merge the PR to fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants