Skip to content

Commit ea46785

Browse files
author
Matt Arnold
committed
Added the plugin.
1 parent 2efb9f7 commit ea46785

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

Context.sublime-menu

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[
2+
{
3+
"id" : "scsscompile",
4+
"caption" : "Compile selected SCSS",
5+
"command" : "scsscompile"
6+
}
7+
]
8+

scsscompile.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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)

0 commit comments

Comments
 (0)