Workflow setup
I am new to PHPstorm (and IDE's in general). But read a lot about it. Have the PHPstorm XAMPP, XDebug setup pretty much running.
But now struggling with the project setup.
My folder setup:
/src => Source from which I compile my code
/dist => Compiled code that I upload to my Google App Engine
With a Gulp script I compile my code with task like handlebars to implement my language specific string, minifying several data and compiling some other stuff. This works great. Especially as I can compile it for my test environment, which is easier to debug as code is not minified and my debugging system is enabled.
Now my problem is that I have a src folder where I need to code and the dist folder which I need to run my code and test if everything works like expected. Now I can exclude my dist folder so PHPstorm does not tell me that there is duplicate code etc etc. But that does not solve the workflow issue where I need to code (/src), run Gulp, run my compiled (/dist) code, test it and fix my source code (/src).
Is there any way to handle this? I have looked but I could not find a manual or advise. Can someone guide me in the right direction or give me a bit more insight?
Please sign in to leave a comment.
What problems working with your setup have you faced? It doesn't look unusual
My problem is how to set this up.
Example: I am writing a new piece of code and I'd like to test it. Then I see a nice Run>Debug feature. But I can't use it as I can't run the raw src code. At least not with the current setup. So then the debug feature itself can't work as should run Gulp, then understand which file to debug from the dist folder and then debug it.
So I am looking for a manual or a demos how other people set this up in these kind of cases to get maximum use out of PHPstorm. One of my problems is that I know PHP but never learned to write modern coding styles and working with frameworks.
The workflow I imagine right now is:
Window 1
Window 2
The only sensible solution right now for me looks like to modify my code and Gulp setup so I can run the src code directly. But I'd rather not for several good reasons.
>I am writing a new piece of code and I'd like to test it. Then I see a nice Run>Debug feature. But I can't use it as I can't run the raw src code.
If you have sourcemaps generated when compiling and minifying your code, you can add breakpoints to your source files and then debug the generated stuff, the debugger should be able to map your source files to the generated ones
Thanks for the input.
I must say this is so complex to setup. Damn! After a day of trail and error I have it pretty much running. Now if I run or debug a generated file then the source file automatically opens and breakpoints are recognised. So that's a win!
Problems found and hopefully fixed:
Outstanding problems/questions:
Right now I debug my files in the dist folder. Which gives the URL: http://localhost:63342/Projectname/dist/index.php.
Is there anyway I can get this to http://localhost/index.php or http://localhost:63342/index.php ?
>Is there anyway I can get this to http://localhost/index.php or http://localhost:63342/index.php ?
No, the built-in web server always serves files from
http://localhost:63342/<project name>, there is no way to alter its doc rootFound a way to do this:
This cool guy gave great input with his Youtube movie: https://www.jetbrains.com/help/phpstorm/deploying-applications.html
Together with https://stackoverflow.com/questions/46798103/phpstorm-jetbrains-how-to-automatically-upload-a-gulp-sass-generated-css-file
So if I run my Gulp task now PHPstorm automatically uploads the files from the dist directory to the webserver. And there I can run and debug my code just by opening my website via https://localhost/ and adding breakpoints to my original code.
So again a few steps forward. Seems we are getting there.
Now also fixed the https setup of my webserver by migrating my whole website to 127.0.0.1
This means:
As far as I can see pretty much all works now. So now I can start coding and especially debugging :-)
Thanks Elena for the help!
Great, thanks for update!