Skip to content

Instantly share code, notes, and snippets.

@armonge
Created April 3, 2014 15:42
Show Gist options
  • Save armonge/9956845 to your computer and use it in GitHub Desktop.
Save armonge/9956845 to your computer and use it in GitHub Desktop.
Compile less on save
function LessToCss()
let current_file = shellescape(expand('%:p'))
let filename = shellescape(expand('%:r'))
let command = "silent !lessc " . current_file . " " . filename . ".css"
echo 'less compilation finished'
execute command
endfunction
autocmd BufWritePost,FileWritePost *.less call LessToCss()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment