Skip to content
Permalink
Browse files
merge master
  • Loading branch information
ralsina committed Sep 15, 2015
2 parents a0e58f2 + 6e7be0c commit 3d17f2ac608e02aeacbfbd15e827bd68dac46f83
Showing with 14 additions and 2 deletions.
  1. +2 −0 CHANGES.txt
  2. +5 −1 nikola/plugins/task/bundles.py
  3. +7 −1 nikola/utils.py
@@ -20,6 +20,8 @@ Bugfixes
--------

* Rebuild pages when user changes POST_SECTION_COLORS (Issue #2066)
* Look for bundle assets also in output/, allowing bundling of files
created by plugins (Issue #1370)
* In listings, if lexer is not specified, use literal (Issue #2078)
* Remove bogus ambiguity on listing links (Issue #2080)
* Unix-slash caused conflict in windows (Issue #2079)
@@ -101,7 +101,11 @@ def build_bundle(output, inputs):
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']) or fname == os.path.join('assets', 'css', 'code.css')]
utils.get_asset_path(
fname,
self.site.THEMES,
self.site.config['FILES_FOLDERS'],
output_dir=kw['output_folder']) or fname == os.path.join('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.
@@ -968,12 +968,14 @@ def get_crumbs(path, is_file=False, index_folder=None):
return list(reversed(_crumbs))


def get_asset_path(path, themes, files_folders={'files': ''}, _themes_dir='themes'):
def get_asset_path(path, themes, files_folders={'files': ''}, _themes_dir='themes', output_dir='output'):
"""Return the "real", absolute path to the asset.
By default, it checks which theme provides the asset.
If the asset is not provided by a theme, then it will be checked for
in the FILES_FOLDERS.
If it's not provided by either, it will be chacked in output, where
it may have been created by another plugin.
>>> print(get_asset_path('assets/css/rst.css', ['bootstrap3', 'base']))
/.../nikola/data/themes/base/assets/css/rst.css
@@ -1000,6 +1002,10 @@ def get_asset_path(path, themes, files_folders={'files': ''}, _themes_dir='theme
if os.path.isfile(candidate):
return candidate

candidate = os.path.join(output_dir, path)
if os.path.isfile(candidate):
return candidate

# whatever!
return None

0 comments on commit 3d17f2a

Please sign in to comment.