项目作者: albertito

项目描述 :
css3fmt is an auto-formatter for CSS files
高级语言: Go
项目地址: git://github.com/albertito/css3fmt.git
创建时间: 2020-06-04T20:55:54Z
项目社区:https://github.com/albertito/css3fmt

开源协议:Other

下载


css3fmt

css3fmt is an auto-formatter for
CSS files.

It is not particularly fancy or smart, but it is simple and can automatically
format most CSS files.

Install

css3fmt is written in Go.

  1. go get blitiri.com.ar/go/css3fmt

Editor integration

vim

Put the following into your .vimrc file to auto-indent on save:

  1. function! CSSFormatBuffer()
  2. let l:curw = winsaveview()
  3. let l:tmpname = tempname()
  4. call writefile(getline(1,'$'), l:tmpname)
  5. let l:out = system("css3fmt " . l:tmpname)
  6. call delete(l:tmpname)
  7. if v:shell_error == 0
  8. try | silent undojoin | catch | endtry
  9. silent %!css3fmt
  10. else
  11. echoerr l:out
  12. endif
  13. call winrestview(l:curw)
  14. return v:shell_error == 0
  15. endfunction
  16. autocmd filetype css
  17. \ autocmd bufwritepre <buffer> call CSSFormatBuffer()

Contact

If you have any questions, comments or patches please send them to
albertito@blitiri.com.ar.