Static file workflow?

Just wondering what peoples workflow with static files is like?

I’m building a site using only static files for Templates, Snippets and Chunks. So far it’s going well but for one minor annoyance: Whenever I want to view changes on my local copy of the site I must clear the cache. Would anyone know of a way to automate this?

Any other tips for static file workflow?

1 Like

Welcome to the Community! :slight_smile:

Afaik MODX takes the static files as they are, but uses them as reference to still build the site with its own system. So the contents of your static files are checked with those in the database and are then changed there (or not). This is also the reason why you need to clear your cache, for MODX to check on the database again for changes (see also this post for a good explanation).

So unfortunately, I’m not aware of any workaround here. Is there a specific reason for you, to only use static files?

2 Likes

You can check some of the Extras to simplify your de-caching. Clearing the cache is a key step in checking your work, unless you use another browser or better yet another device

https://modx.com/extras/browse/?search=cache

1 Like

Thanks for the advice.

Is there a specific reason for you, to only use static files?

So I can:

  • Version control with Gtihub
  • Use my IDE and it’s plugins
  • Run Gulp commands against them to compile, lint and minify.

If there’s a more established workflow with MODX I’m keen to learn!

2 Likes

There may be a better way but i usually run a node application in the background that runs and deletes the cache folder every time I save a file

2 Likes

There is also the CacheClear extra which makes it a little more convenient completely clear the cache.

2 Likes

i usually run a node application in the background that runs and deletes the cache folder every time I save a file

Hey, that’s a great idea! Sounds like what I’m after. Thanks!

1 Like