Open kottenator opened 10 years ago
There are several things to consider:
1 This live-proxy thing is very basic at the moment. It assumes that you have some source file that you need to watch for changes, and that every time you change it, it will cause responses to requests to some "corresponding" URL to change as well. For now, that URL is calculated from single root URL setting based on source folder structure.
If this is not enough for particular type of projects, we can easily add some way to override URLs for specific files in one of next COLT updates (e.g. you will need to specify that changes in file xxx.js will be served from http://server/special/path/yyy.js). It might be even possible to make it work with different files pointing to the same (merged) URL. (update: see the comment below)
2 Livecoding in minified javascript is currently disabled for performance reasons, because it is expected that these files would be mostly things like jquery.min.js that take time to parse and at the same time noone edits them any way.
@makc That is a great idea, it would be great to see that implemented!
Thanks for answer, @makc.
Implementation of the first point is really necessary for Django, because static files are located in app folders, while they are mapped to /static/ URL.
Waiting for COLT updates in this direction then, and thank you for developing such a great development tool!
P.S.: COLT + Django tutorial will be appreciated anyway ;)
Ok, it appears I gave you wrong answer :) The thing is, COLT remembers and watches all requested URLs. If COLT cannot find local source file corresponding to the URL, it sends request to tht URL every 300ms and checks modification date header, or content if there is no date. So, you still should be able to use COLT for livecoding or live HTML editing even if URLs do not correspond to local source structure.
Ok, but how could I debug my JS code if source file path is not equal to its URL on the page?
Of course, there is no way to build sourcemap without association to original source, so browser devtools probably can't be used for anything beyond simple console.log(...) calls in that case. Sublime or webstorm plugins, again, will require that association in order to do things like variables inspection, etc. Code updates should still work¹, though, so you can use COLT event handlers to evaluate / log various expressions.
¹ btw this assumes you either edit source files directly on server filesystem or have something that reuploads them there.
I want an advice, or some kind of tutorial - how to use COLT with a Django project?
I will explain the problem.
COLT has a live-proxy mode (which is recommended for my case), but then it still needs files to open: http://myserver/index.html, http://myserver/script.js
But Django doesn't have such files - URLs are dynamically mapped to views, which are dynamically generating pages from Django templates; JS files could be compiled from CoffeeScript and then minified and merged on the server-side (and I also use SCSS which is compiled to CSS).
I have installed COLT plugin into my PyCharm and successfully launched my Django project's homepage with COLT... but I don't understand what to do next. Please, advise