34
34
except ImportError :
35
35
webassets = None # NOQA
36
36
37
- from nikola .plugin_categories import LateTask
37
+ from nikola .plugin_categories import Task
38
38
from nikola import utils
39
39
40
40
41
- class BuildBundles (LateTask ):
41
+ class BuildBundles (Task ):
42
42
"""Bundle assets using WebAssets."""
43
43
44
44
name = "create_bundles"
@@ -54,8 +54,8 @@ def set_site(self, site):
54
54
site .config ['USE_BUNDLES' ] = False
55
55
self .cdn_js_urls = []
56
56
self .cdn_css_urls = []
57
-
58
57
super (BuildBundles , self ).set_site (site )
58
+ self .inject_dependency ('render_pages' , 'create_bundles' )
59
59
60
60
def url_from_entry (self , entry ):
61
61
"""Turn a bundles entry into a URL from cdnjs"""
@@ -111,7 +111,7 @@ def build_bundle(output, inputs):
111
111
if (webassets is not None and self .site .config ['USE_BUNDLES' ] is not
112
112
False ):
113
113
for name , _files in kw ['theme_bundles' ].items ():
114
-
114
+
115
115
# If using a CDN, remove those files that will be delivered by the CDN
116
116
t_files = []
117
117
if kw ['use_cdn' ]:
@@ -122,17 +122,17 @@ def build_bundle(output, inputs):
122
122
t_files .append (i )
123
123
else :
124
124
if url .endswith ('js' ):
125
- cdn_js_urls .append (url )
125
+ self . cdn_js_urls .append (url )
126
126
else :
127
- cdn_css_urls .append (url )
127
+ self . cdn_css_urls .append (url )
128
128
else : # No CDN, remove the package::file notation
129
129
for i in _files :
130
130
if '::' in i :
131
131
i = i .split ('::' )[- 1 ]
132
132
t_files .append (i )
133
-
133
+
134
134
_files = t_files
135
-
135
+
136
136
output_path = os .path .join (kw ['output_folder' ], name )
137
137
dname = os .path .dirname (name )
138
138
files = []
0 commit comments