Auto import static files

This commit is contained in:
Ruud
2011-08-03 22:02:19 +02:00
parent 5dd802bc31
commit cd82943279
11 changed files with 15 additions and 25 deletions
+5 -1
View File
@@ -1,6 +1,9 @@
from couchpotato import addView
from couchpotato.core.event import fireEvent
from couchpotato.core.helpers.variable import getExt
from couchpotato.environment import Env
from flask.helpers import send_from_directory
import glob
import os.path
import re
@@ -25,7 +28,8 @@ class Plugin():
path = 'static/' + class_name + '/'
addView(path + '<path:file>', self.showStatic, static = True)
return path
for file in glob.glob(os.path.join(self.plugin_path, 'static', '*')):
fireEvent('register_script' if getExt(file) in 'js' else 'register_style', path + os.path.basename(file))
def showStatic(self, file = ''):
dir = os.path.join(self.plugin_path, 'static')