CSS-Extended
CSS-Extended copied to clipboard
When the parameter "load_external_files" is empty, traverse the folder and look for all the files specified in "css_extension".
When the parameter "load_external_files" is empty, traverse the folder and look for all the files specified in "css_extension".
Modify the file: project.py for the following(By default(implemented functionality, unaffected.), the css file in "link" is looked up in the HTML file.):
import sublime, glob, os
ST2 = int(sublime.version()) < 3000
if ST2:
import settings
else:
from . import settings
def get_all_files(path):
files = []
if not os.path.isdir(path):
raise
for x in os.listdir(path):
f = os.path.join(path, x)
if os.path.isdir(f):
files.extend(get_all_files(f))
else:
files.append(f)
return files
def get_external_files():
_load_external_files = settings.get('load_external_files', [])
_css_extension = settings.get('css_extension', [])
external_files = []
_tmp_files = []
if _load_external_files == []:
_load_external_files = sublime.active_window().folders()
if _css_extension == []:
_css_extension = ['.css', '.less', '.scss']
for _dir in _load_external_files:
_tmp_files.extend(get_all_files(_dir))
for _x in _tmp_files:
for _y in _css_extension:
if _x.endswith(_y):
external_files.append(_x)
else:
for file_path in _load_external_files:
external_files.extend(glob.glob(file_path))
print(external_files)
return external_files
If you want to control whether all CSS files in the entire project are automatically processed when Sublime Text 3 starts, you can change the
_load_external_files == []
in the file project.py
to:
_load_external_files == "auto"
and change the value of the parameter load_external_files
to: auto
, like this:
"load_external_files": "auto"
I like this extension a lot but as I have several css files on the pages it locks up the sublime, it gets all the css files and lock it has to sort it?