Sublime Sftp - Upload Compiled CSS When SASS File Saved

Sublime SFTP - Upload compiled css when sass file saved

I'll throw my solution into the mix, just in case anyone stumbles on this as I did and wants to stick as close to a solely ST-based workflow as possible. If you're using the SFTP package for ST, there is an option to monitor files for external saves.

Sample Image

Unfortunately, using the ST build system to compile my SASS somehow slipped by SFTP. SASS CLI's watch utility, however, triggers the upload just fine. Once set, presuming the target file remains open, SFTP will upload it after each build.

To recap,

  1. Open target file, followed by the command palette. Enter SFTP: Monitor File (Upload on External Save)

  2. Start whatever CLI watch/build utility you prefer, for me, Sass: sass --watch app.scss:app.css

  3. Leave target file open, otherwise the SFTP monitor seems to cease.

Enjoy!

NOTE: You can also enable file monitoring from the sidebar by right clicking on the file you wish to monitor and selecting...

Sidebar Dialog Option for enabling File Monitoring

Is there any method to edit SASS/LESS files online via FTP

I agree with @RobertWade that this should be part of your version control and build process. You may like to start with a simple gulp sass build process running on your server. Here's a walkthrough http://ryanchristiani.com/getting-started-with-gulp-and-sass/

Develop SASS locally, upload on change

Since the question was asked in 2011 Compass has evolved and now provides callback functions to do exactly what was asked in the question:

For Step 3 you can use on_stylesheet_saved and on_sourcemap_saved callback functions to upload your *.css and *.css.map files to the production server.

Sample code how to do this can be found in this StackOverflow answer



Related Topics



Leave a reply



Submit