scss-modeの導入

環境

  • Ubuntu 12.04 LTS
  • emacs 23.3.1
  • rbenv 0.4.0-129-g7e0e85b
  • ruby 2.1.4p265
  • rubygem 2.4.3

Gemライブラリー sassとcompassの導入

% gem install sass
% sass --version
Sass 3.4.7 (Selective Steve)

% gem install compass
% compass --version
Compass 1.0.1 (Polaris)
Copyright (c) 2008-2014 Chris Eppstein
Released under the MIT License.
Compass is charityware.
Please make a tax deductable donation for a worthy cause: http://umdf.org/compass

rbenv.elの設置

emacsからrbenvでインストールしたコマンドをうまく呼び出せないので、GitHub: senny/rbenv.elを利用する。

% cd ~/.emacs.d
% mkdir elisp
% cd elisp
% git clone https://github.com/senny/rbenv.el.git

scss-modeの設置

GitHub: antonj/scss-modeより取得する。

% git clone https://github.com/antonj/scss-mode.git

init.el の設定

;; rbenv.el
(add-to-list 'load-path "~/.emacs.d/elisp/rbenv.el")
(require 'rbenv)
(global-rbenv-mode)

;; scss-mode
;; https://github.com/antonj/scss-mode
(add-to-list 'load-path "~/.emacs.d/elisp/scss-mode")

(autoload 'scss-mode "scss-mode")
(add-to-list 'auto-mode-alist '("\\.\\(scss\\|css\\)\\'" . scss-mode))

;; 参考: http://blog.kzfmix.com/entry/1363086082
(add-hook 'scss-mode-hook
	  (lambda()
	    (seq css-indent-offset 2)
	    (setq scss-sass-options '("--compass"))
	    (setq scss-compile-at-save nil)
	    (flymake-mode t)
     ))

;; Prevent emacs from dying flymake by configuration error.
;; http://d.hatena.ne.jp/sugyan/20100705/1278306885
(defadvice flymake-post-syntax-check (before flymake-force-check-was-interrupted)
  (setq flymake-check-was-interrupted t))
(ad-activate 'flymake-post-syntax-check)