Seravo / wordpress

The WordPress project layout used by many of Seravo's customers, suitable also for local development with Vagrant and git deployment
https://seravo.com
GNU General Public License v3.0
102 stars 54 forks source link

In post-receive run gulp also on JS file changes #172

Open samikeijonen opened 3 years ago

samikeijonen commented 3 years ago

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 3 years ago

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.

samikeijonen commented 3 years ago

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.