Setting Vim for sass

Setting sass on vim to enable automatic compilation.

Install sass and compass

//$ gem install sass compass
$ sudo npm install -g sass
$ yaourt -S sass

Check sass command to make sure properly installed sass

$ sass
$ vim ~/.vimrc

Add search-parent.vim and sass-compile.vim plugin in your .vimrc. In this case, using dein. package manager.
.vimrc

" sass
"------------------------------------
""{{{
  let g:sass_compile_auto = 1
  let g:sass_compile_cdloop = 5
  let g:sass_compile_cssdir = ['css', 'stylesheet']
  let g:sass_compile_file = ['scss', 'sass']
  let g:sass_compile_beforecmd = ''
  let g:sass_compile_aftercmd = ''
  autocmd FileType less,sass  setlocal sw=2 sts=2 ts=2 et
  au! BufWritePost * SassCompile
"}}}
call dein#add('AtsushiM/search-parent.vim')
call dein#add('AtsushiM/sass-compile.vim')

Update dein in your vim

:call dein#install()

Create sass file.

$ vim sass/style.scss

style.sass

html{
    font-size: 14px;
    body{
        margin: 0 auto;
    }
}

Please check genrating css/style.css file after save it.

関連記事