Skip to content
Browse files

Merge pull request #9 from adeandrade/master

Support A Custom Output Directory For Compiled Files. Avoid Compiling Partial Files By Using The --update Option.
  • Loading branch information...
2 parents 2d25dec + 88fc639 commit 668e857bc8672baffbd8e77bf8f20c928202061c @antonj committed
Showing with 12 additions and 5 deletions.
  1. +12 −5 scss-mode.el
View
17 scss-mode.el
@@ -53,6 +53,11 @@
'(\"--cache-location\" \"'/tmp/.sass-cache'\")"
:group 'scss)
+(defcustom scss-output-directory nil
+ "Output directory for compiled files, for example:
+\"../css\""
+ :group 'scss)
+
(defcustom scss-compile-error-regex '("\\(Syntax error:\s*.*\\)\n\s*on line\s*\\([0-9]+\\) of \\([^, \n]+\\)" 3 2 nil nil 1)
"Regex for finding line number file and error message in
compilation buffers, syntax from
@@ -70,11 +75,13 @@ HYPERLINK HIGHLIGHT)"
(scss-compile)))
(defun scss-compile()
- "Compiles the current buffer, sass filename.scss filename.css"
+ "Compiles the directory belonging to the current buffer, using the --update option"
(interactive)
- (compile (concat scss-sass-command " " (mapconcat 'identity scss-sass-options " ") " "
- "'" buffer-file-name "' '"
- (first (split-string buffer-file-name "[.]scss$")) ".css'")))
+ (compile (concat scss-sass-command " " (mapconcat 'identity scss-sass-options " ") " --update "
+ (when (string-match ".*/" buffer-file-name)
+ (concat "'" (match-string 0 buffer-file-name) "'"))
+ (when scss-output-directory
+ (concat ":'" scss-output-directory "'")))))
;;;###autoload
(define-derived-mode scss-mode css-mode "SCSS"
@@ -111,4 +118,4 @@ Special commands:
(add-to-list 'auto-mode-alist '("\\.scss\\'" . scss-mode))
(provide 'scss-mode)
-;;; scss-mode.el ends here
+;;; scss-mode.el ends here

0 comments on commit 668e857

Please sign in to comment.
Something went wrong with that request. Please try again.