summaryrefslogtreecommitdiffstats
path: root/nikola/plugins/task/bundles.py
diff options
context:
space:
mode:
Diffstat (limited to 'nikola/plugins/task/bundles.py')
-rw-r--r--nikola/plugins/task/bundles.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/nikola/plugins/task/bundles.py b/nikola/plugins/task/bundles.py
index fcfaf42..7437a9d 100644
--- a/nikola/plugins/task/bundles.py
+++ b/nikola/plugins/task/bundles.py
@@ -65,8 +65,7 @@ class BuildBundles(LateTask):
def build_bundle(output, inputs):
out_dir = os.path.join(kw['output_folder'],
os.path.dirname(output))
- inputs = [i for i in inputs if os.path.isfile(
- os.path.join(out_dir, i))]
+ inputs = [os.path.relpath(i, out_dir) for i in inputs if os.path.isfile(i)]
cache_dir = os.path.join(kw['cache_folder'], 'webassets')
utils.makedirs(cache_dir)
env = webassets.Environment(out_dir, os.path.dirname(output),
@@ -83,20 +82,32 @@ class BuildBundles(LateTask):
yield self.group_task()
if (webassets is not None and self.site.config['USE_BUNDLES'] is not
False):
- for name, files in kw['theme_bundles'].items():
+ for name, _files in kw['theme_bundles'].items():
output_path = os.path.join(kw['output_folder'], name)
dname = os.path.dirname(name)
- file_dep = [os.path.join(kw['output_folder'], dname, fname)
+ files = []
+ for fname in _files:
+ # paths are relative to dirname
+ files.append(os.path.join(dname, fname))
+ file_dep = [os.path.join(kw['output_folder'], fname)
for fname in files if
- utils.get_asset_path(fname, self.site.THEMES, self.site.config['FILES_FOLDERS'])]
+ utils.get_asset_path(fname, self.site.THEMES, self.site.config['FILES_FOLDERS'])
+ or fname == 'assets/css/code.css']
+ # code.css will be generated by us if it does not exist in
+ # FILES_FOLDERS or theme assets. It is guaranteed that the
+ # generation will happen before this task.
task = {
'file_dep': list(file_dep),
- 'task_dep': ['copy_assets'],
+ 'task_dep': ['copy_assets', 'copy_files'],
'basename': str(self.name),
'name': str(output_path),
- 'actions': [(build_bundle, (name, files))],
+ 'actions': [(build_bundle, (name, file_dep))],
'targets': [output_path],
- 'uptodate': [utils.config_changed(kw)],
+ 'uptodate': [
+ utils.config_changed({
+ 1: kw,
+ 2: file_dep
+ })],
'clean': True,
}
yield utils.apply_filters(task, kw['filters'])