Gitlab CI, combine only>changes and only->refs, .gitlab-ci.yml

Hello I wondered with the new funcunaleties of https://docs.gitlab.com/ee/ci/yaml/#onlychangesexceptchanges. It allows us to only run a certain job if a file or a folder has changed.
I wounder if anyone know know to set it up so a job only runs if a directory has haves changes of if the you are on master branch.

.client-build-core:
  retry: 1
  dependencies:
    - client-npm-install
  script:
    - tar -xhf node_modules.tar.gz client/node_modules
    - cd client
    - npm install
    - cp src/environments/environment.template.ts src/environments/environment.ts
    - cp src/environments/environment.template.ts src/environments/environment.prod.ts
    - "sed -i 's/production: false/production: true/g' src/environments/environment.prod.ts"
    - npm run build -- -c production

client-build:
  extends: .client-build-core
  only:
    - master

client-build-changes:
  extends: .client-build-core
  only:
    changes:
      - client/**/*
    except:
      - master

This works but is is long.