Seravo/wordpress

In post-receive run gulp also on JS file changes

samikeijonen opened this issue · 2 comments

It's common that Gulp handles all the assets like CSS and JS. At the moment gulp is run when $SCSS_CHANGED is true in post-receive hook.

It would make sense that by default it would catch changes on JS files also. Maybe it can be called ASSETS_CHANGED instead of SCSS_CHANGED.

And then something like:

ASSETS_CHANGED=false
elif [[ "$line" =~ \.scss ]] || [[ "$line" =~ \.js ]]
    then
      ASSETS_CHANGED=true

I'm also not certain should there be npm install before gulp, haven't tested this yet.

ottok commented

Sorry for late reply. We don't have npm install in the example, as it often is so slow and pulling in a lot of dependencies might cause unpredictable end results.

You are however free to modify the git hook in your own project to perfectly fit your custom needs. The project template is an example of how things can be done and there is no need to adhere to it exactly.

If/when there later are updates to the project template, you can either use git merge or wp-fix-project to import new upstream changes.

Yep, we already modified this :)

P.S. I'd personally add comment around gulp since it doesn't do anything on it's own. And it makes assumption that there is no build or dist folder in the repo.