Watching certain folders

I am using Nuxt, and probably because my folder structure is a little strange that it causes problem.

The structure is

  • data/
  • editor/ (which is actually “admin”)
  • web/ (which is deployed)
  • lib/ (shared between editor/ and admin/)

I want build script inside web/ to be triggered when data/, lib/ or web/ changes. Currently, it is triggered on git push origin master, if the content inside web/ changes.

This repo, actually.

What I am truly looking for, is a static site generator with customizable markdown syntax. I find showdown.js to be the easiest to extend. That’s how I came about.

I also posted why I currently choose Netlify over Now.sh or Heroku here – https://zhlab.polvcode.dev/post/move-to-netlify

Hello, @patarapolw, and welcome to our Netlify community site.

You can configure a command of your own to determine when to build and not to build. If the command in question returns an exit code of 0 (success), then the build will exit. If the command returns a non-zero exit code, the build will continue.

There is more documentation about this including an example command here:

Would you please let us know if this will meet the requirements for determining when to build?

I don’t really understand, but maybe I can just use

[build]
  ignore = "1"

@patarapolw, the ignore option is a command to be run. If you make this command 1 it won’t exist, therefore will always return an error and all git pushes will trigger a build.

The solution is to make this command something that detects your changes. The command in the example is this:

git diff --quiet HEAD^ HEAD sub_dir/

The checks for changes in the subdirectory named “sub_dir/” and only builds if that directory has changed.

I want build script inside web/ to be triggered when data/, lib/ or web/ changes.

If this is the case, then possibly the following ignore command is what you want:

[build]
  ignore = "git diff --quiet HEAD^ HEAD data/ && git diff --quiet HEAD^ HEAD lib/ && git diff --quiet HEAD^ HEAD web/"

Would you please try that and let us know if it works for you?

1 Like