File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 1+ [
2+ {
3+ "id" : " scsscompile" ,
4+ "caption" : " Compile selected SCSS" ,
5+ "command" : " scsscompile"
6+ }
7+ ]
8+
Original file line number Diff line number Diff line change 1+ import sublime , sublime_plugin
2+ from subprocess import Popen , PIPE , STDOUT
3+
4+ class scsscompileCommand (sublime_plugin .TextCommand ):
5+ def run (self , edit ):
6+ for region in self .view .sel ():
7+ if not region .empty ():
8+ # Get the selected text
9+ s = self .view .substr (region )
10+ p = Popen (['scss' ], stdout = PIPE , stdin = PIPE , stderr = PIPE )
11+ stdout_data = p .communicate (input = bytes (s , 'UTF-8' ))[0 ]
12+ # print(stdout_data)
13+ stdout_data = str (stdout_data ).replace ('\\ n' , '\n ' )
14+ stdout_data = stdout_data [2 :- 1 ]
15+ self .view .replace (edit , region , stdout_data )
You can’t perform that action at this time.
0 commit comments