use a resource system to load images and stylesheet

This commit is contained in:
Mathieu PATUREL
2019-11-15 07:21:41 +11:00
parent 8c1012eb8c
commit 5f2cac54e8
10 changed files with 48 additions and 13 deletions

17
resources.py Normal file
View File

@ -0,0 +1,17 @@
import os.path
import sublime
def get_resource(resource):
path = 'Packages/MarkdownLivePreview/resources/' + resource
abs_path = os.path.join(sublime.packages_path(), '..', path)
if os.path.isfile(abs_path):
with open(abs_path, 'r') as fp:
return fp.read()
return sublime.load_resource(path)
resources = {}
def plugin_loaded():
resources["base64_loading_image"] = get_resource('loading.base64')
resources["base64_404_image"] = get_resource('404.base64')
resources["stylesheet"] = get_resource('stylesheet.css')