From 9fa733afe4115ee1ddae86a4c43df40a1410a9e1 Mon Sep 17 00:00:00 2001 From: James Doyle Date: Sat, 7 Mar 2020 14:23:06 -0800 Subject: [PATCH] Fixed: bundle path for package installation outside package control --- TailwindCSSAutocomplete.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/TailwindCSSAutocomplete.py b/TailwindCSSAutocomplete.py index 413e50b..5179a62 100644 --- a/TailwindCSSAutocomplete.py +++ b/TailwindCSSAutocomplete.py @@ -19,9 +19,15 @@ def get_completions(self, view, folder): tw_plugin = self.find_node_module(folder, 'tailwindcss') if tw is not None and tw_plugin is not None: + try: + bundle = sublime.load_resource('Packages/TailwindCSSAutocomplete/dist/bundle.js') + except: + # if this package is not installed via package control, we need to load the bundle locally + bundle = open(os.path.dirname(__file__) + '/dist/bundle.js', 'r', encoding="utf-8").read() + try: script = 'var sublime={config:"' + tw + '",plugin:"' + tw_plugin + '"};' - script += sublime.load_resource('Packages/TailwindCSSAutocomplete/dist/bundle.js') + '\n' + script += bundle + '\n' process = subprocess.Popen( [view.settings().get('node_path', 'node')], stdin = subprocess.PIPE,