I've been trying to adopt Sass into my development workflow. I do primarily front-end development and as such, I am updating stylesheets quite frequently. After endless searching, I have yet to find the answer to what I feel should be a simple question.
I use both Coda and Textmate, so a solution for either would suffice. When developing locally, I open the terminal, get my .scss file watched, then go to town. I save my .scss file, it happily updates my .css file... and then I'm left with the slight annoyance of having to manually select the .css and publish it to the remote server.
Its not the end of the world but having to pause my usual dev workflow to manually upload a file I'm not actively in is becoming a nuisance. In Coda, it doesn't detect when a file has been updated outside of Coda, so it isn't marked for publishing. Its driving me crazy. I开发者_如何学运维 just need a way to save the .scss file and have the .css file easily/automatically uploaded to the remote server. Any help would be greatly appreciated!The typical way Sass is used is to design on your local computer while using Sass, and to only upload the CSS (and probably the Sass as well) to the server once you're finished. Another alternative would be to run sass --watch
on the server so that it compiles the uploaded Sass files.
I have had a rake task that calls rsync for this kind of cases. That still needs to be run each time but because it uses rsync only the changed files are moved. Now, while reading this I got an idea that shouldn't there be 'rsync watch' somewhere and indeed there seems to be: http://code.google.com/p/lsyncd/
Here's an interesting approach I just read about, installing compass into a small local ruby env, inspired by python virtualenv: http://rhodesmill.org/brandon/2011/adding-compass/
YMMV (I haven't even tried this myself).
The Sublime SFTP/FTP Plugin can monitor and auto-upload the .css output file whenever it's updated by the SCSS compiler.
- Map your project directory to your server
- Check it's woking correctly by browsing remote
- Right click on your .css output file, and choose 'Monitor File (Upload on External Save)'
- Keep the file's tab open in Sublime to ensure it stays monitored/uploaded.
For extra points, have a look at Browsersync or LiveReload.
精彩评论