Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d42c679

Browse files
committedMay 5, 2015
start using dependency injection
1 parent 74c424a commit d42c679

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed
 

‎nikola/plugins/task/bundles.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
except ImportError:
3535
webassets = None # NOQA
3636

37-
from nikola.plugin_categories import LateTask
37+
from nikola.plugin_categories import Task
3838
from nikola import utils
3939

4040

41-
class BuildBundles(LateTask):
41+
class BuildBundles(Task):
4242
"""Bundle assets using WebAssets."""
4343

4444
name = "create_bundles"
@@ -54,8 +54,8 @@ def set_site(self, site):
5454
site.config['USE_BUNDLES'] = False
5555
self.cdn_js_urls = []
5656
self.cdn_css_urls = []
57-
5857
super(BuildBundles, self).set_site(site)
58+
self.inject_dependency('render_pages', 'create_bundles')
5959

6060
def url_from_entry(self, entry):
6161
"""Turn a bundles entry into a URL from cdnjs"""
@@ -111,7 +111,7 @@ def build_bundle(output, inputs):
111111
if (webassets is not None and self.site.config['USE_BUNDLES'] is not
112112
False):
113113
for name, _files in kw['theme_bundles'].items():
114-
114+
115115
# If using a CDN, remove those files that will be delivered by the CDN
116116
t_files = []
117117
if kw['use_cdn']:
@@ -122,17 +122,17 @@ def build_bundle(output, inputs):
122122
t_files.append(i)
123123
else:
124124
if url.endswith('js'):
125-
cdn_js_urls.append(url)
125+
self.cdn_js_urls.append(url)
126126
else:
127-
cdn_css_urls.append(url)
127+
self.cdn_css_urls.append(url)
128128
else: # No CDN, remove the package::file notation
129129
for i in _files:
130130
if '::' in i:
131131
i = i.split('::')[-1]
132132
t_files.append(i)
133-
133+
134134
_files = t_files
135-
135+
136136
output_path = os.path.join(kw['output_folder'], name)
137137
dname = os.path.dirname(name)
138138
files = []

0 commit comments

Comments
 (0)
Please sign in to comment.