php - How to keep source and build folders in sync during debugging? -
recently, updated php project use source folder , build folder. we're using gulp build project 'src' folder 'build' folder after pulling 'src' folder , project configuration files our git repo.
project_root | ├── src | ├── build | └── {project configuration files}
both frontend , backend developers running 'gulp watch' we've setup keep our 'src' , 'build' folders in sync.
one of biggest annoyances we've encountered while debugging our project in browser open offending file error reported , tinker code until works in browser. however, more times i'd count, make change file in 'build' folder while debugging , have manually make change in 'src' folder (which overlooked @ first).
is there way fix workflow issue?
dueling watchers approach
i thought making 2 file watchers detect changes in 'build' , 'src' folders respectively. when either watch detects change, turn off other folders watcher, process changed files , sync other folder, turns other folder's watcher on.
(this seems sledge-hammer approach.)
ide approach
we phpstorm , sublime text 3 depending on developer. in sublime text, exclude 'build' folder project don't accidentally open default. (however, accidentally open 'build' folder files when debugging php often.)
other
perhaps way we're handling project structure in general needs work. frontend , backend development done in concert. suggestions?
after flailing arms wildly @ problem few hours after posting found answer own problem.
turns out best way handle use ide approach , create path mappings project:
phpstorm (documentation)
- settings » php » servers
- check 'use path mappings' selection.
- in our case mapped
'../src'
folder'../build'
sublime text 'xdebug client' package
preferences » package settings » xdebug » settings - user
- add following xdebug.sublime-settings file:
{ "path_mapping": { "c:/wamp/www/fcweb-2/build" : "c:/wamp/www/fcweb-2/src" } }
once path mappings setup, can set breakpoint in php file in '../src'
folder run debugging session , file in '../build'
folder breakpoint @ same location.
Comments
Post a Comment