Recompile SCSS when saving |
Guru master
|
Magento has a reasonably complex SCSS structure, with around 66 files that get reduced down to 7 after being compiled. I use Ruby and Compass to do the compilation. For each project I create a watch.bat file in a work folder for that project that contains this command:
Then when I'm working on SCSS, using PhpED I right-click and shell open that batch file, then shuffle that window where I can keep an eye on it. Using a consistent directory and method of opening the batch file ensures the sass-cache is located in the same place every time. After doing an edit on any SCSS file it takes just a second to detect the changes, then it compiles within a few seconds. The watcher can be left running all day and doesn't seem to use a lot of resources. Doesn't bother me that it is a separate process and I prefer the separate window because it is not taking up IDE space. PhpED runs great on a standalone computer. |
||||||||||||||
|
|
Thanks.
But doesn't compass watch use the same ruby watcher as sass --watch command? Also, having a terminal window open all the time in the taskbar is beyond my understanding of things. Koala on the other hand seems perfect for the needs: It is minimized to the tray and in case of compile error it displays an error message/balloon. It reacts instantly to file saves which is indispensable - it may be less than a second between I save a file in the IDE and switch to the browser and hit F5 to test. If the compiler doesn't react instantly, this can hinder productivity. 1-2 seconds would be acceptable but Koala recompiles instantly. You define all the projects you want to watch in it, and filter out anything but scss files. The top level project directory is enough. I just start with SASS in general. I guess LESS is a no-go in phped for now. |
||||||||||||
|
Guru master
|
I don't know if it uses the same watcher but i haven't had any of the issues you mentioned with it not detecting changes, using considerable CPU and HDD.
Over the last 12 hours it has used 1 hour of CPU from a single core, so whilst a reasonable amount on a typical 4 to 12 core system it isn't having any impact. Disk access is negligible. I actually like the terminal window. I reduce down to just a few lines and shuffle it off to the edge of a monitor. When I make SCSS changes I can easily see how far it has got before I refresh a Magento page. Because Magento merges & caches the CSS, if I refresh the page too soon it causes problems. |
||||||||||||
|
|
I see. The sass-only --watch'er spawns a ruby process. I'm currently on a 2 core system (typical are 4 core now, to 8 core i7s).
1 hour out of 12 hour lifetime is too much, especially when talking about a simple scss files watcher. Even my FF browser can't get so high in usage. This is about constant 9% on average over time. Too much. It should be almost zero while waiting for changes. Only when recompiling.. Disk usage - the ruby --watch'er didn't let the HDD LED go off at all. A Black WD. No idea what was happening in ruby's mind to cause that. With Koala things are perfect . And unless your S/CSS file is several megabytes long (+ any includes which should already be compiled because you are saving just one/the_current file), the compile should take less than a second. Anyways, my "problem" can be considered solved. About the other question, my worry was after I read a thread here that suggested there was a problem in Phped that would complain about the license if there is no internet connection. |
||||||||||||
|
Guru master
|
That's an average of less than 1% CPU - I'm happy with that. Most days my Firefox uses a heck of a lot more than lot. The HDD light rarely even flashes.
The Magento SCSS totals 1.8MB and with 66 files a 3 second full compile is not unreasonable. Most changes create just 2 CSS output files and that takes less than a second, quicker than I can refresh a browser. Magento is also initially setup for Compass, so it was easy to get going. I'm not aware of PhpED calling home, but it is certainly possible. Must admit I really dislike products that do that, particularly if they block product use when they can't call home. |
||||||||||||
|
|
Yes, that was the point. If you use it on a laptop and you happen to travel or decide to work on vacation where there is not internet, you have all your assets with you, etc. Moreover, it happens the connection is lost for extended periods on bad weather etc.
About the scss - maybe the total is 1.8MB but as you said, you edit one file and when you save, all it has to do is compile that file alone, all other are already compiled, and even if you include bunch of files, they are just that - included and saved to as many resulting CSS'es as planned. I was calculating the 1h/12h situation (on 1 core) - this is about 9% on average CPU usage (1 core). Again, it seems too much for only a watcher, day and night. Maybe it's polling which seems ridiculous. I guess Koala is using the proper method - hooks itself to directory changes and only "awakes" when being notified by the file system of a change. Anyway, if that's the way you like it, it's ok . |
||||||||||||
|
Recompile SCSS when saving |
|
||
Content © NuSphere Corp., PHP IDE team
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by