Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Bin/grav clear-cache everytime I git pull newest changes on my production server

Started by Muut Archive 10 years ago · 5 replies · 483 views
10 years ago

I want to run bin/grav clear-cache automatically everytime I git pull the code from my Bitbucket. Since I have cache on for all my assets, right now if I just git pull something the visual changes (to CSS files and so on) won't be visible without cleaning the cache.

I believe this has something to do with git hooks. How to set this up?

10 years ago

You can create a bash script like

BASH
#!/bin/bash
cd somewhere/grav
git pull
bin/grav clear-cache
10 years ago

@flaviocopes where in git hooks I should put this?

10 years ago

A githook has to call a web URL. So you would need to exec a bash script from a php file. Be careful though, this can easily be abused and potentially causes problems for your site.

BTW Grav should automatically do a cache rebuild when any page or config file changes, so is this really needed?

10 years ago

@rhukster - in my case Grav doesn't clean the cache automatically when I do changes to CSS files so I need to do it myself :(

10 years ago

I take it you are using CSS pipeline. This should be addressed in the imminent release of Grav 1.1

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1369 9 years ago
Archive · by Muut Archive, 9 years ago
2 943 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2960 9 years ago
Archive · by Muut Archive, 9 years ago
3 1126 9 years ago