diff options
| author | 2015-07-08 07:35:02 -0300 | |
|---|---|---|
| committer | 2015-07-08 07:35:02 -0300 | |
| commit | b0b24795b24ee6809397fbbadf42f31f310a219f (patch) | |
| tree | 46d05bb47460b4ec679211717c4ab07414b80d9c /nikola/plugins/task/bundles.py | |
| parent | 5ec02211214350ee558fd9f6bb052264fd24f75e (diff) | |
Imported Upstream version 7.6.0upstream/7.6.0
Diffstat (limited to 'nikola/plugins/task/bundles.py')
| -rw-r--r-- | nikola/plugins/task/bundles.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/nikola/plugins/task/bundles.py b/nikola/plugins/task/bundles.py index fca6924..6f88d0c 100644 --- a/nikola/plugins/task/bundles.py +++ b/nikola/plugins/task/bundles.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright © 2012-2014 Roberto Alsina and others. +# Copyright © 2012-2015 Roberto Alsina and others. # Permission is hereby granted, free of charge, to any # person obtaining a copy of this software and associated @@ -43,11 +43,12 @@ class BuildBundles(LateTask): name = "create_bundles" def set_site(self, site): - super(BuildBundles, self).set_site(site) - if webassets is None and self.site.config['USE_BUNDLES']: + self.logger = utils.get_logger('bundles', site.loghandlers) + if webassets is None and site.config['USE_BUNDLES']: utils.req_missing(['webassets'], 'USE_BUNDLES', optional=True) - utils.LOGGER.warn('Setting USE_BUNDLES to False.') - self.site.config['USE_BUNDLES'] = False + self.logger.warn('Setting USE_BUNDLES to False.') + site.config['USE_BUNDLES'] = False + super(BuildBundles, self).set_site(site) def gen_tasks(self): """Bundle assets using WebAssets.""" @@ -74,7 +75,12 @@ class BuildBundles(LateTask): bundle = webassets.Bundle(*inputs, output=os.path.basename(output)) env.register(output, bundle) # This generates the file - env[output].urls() + try: + env[output].urls() + except Exception as e: + self.logger.error("Failed to build bundles.") + self.logger.exception(e) + self.logger.notice("Try running ``nikola clean`` and building again.") else: with open(os.path.join(out_dir, os.path.basename(output)), 'wb+'): pass # Create empty file @@ -91,8 +97,7 @@ class BuildBundles(LateTask): 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 == 'assets/css/code.css'] + utils.get_asset_path(fname, self.site.THEMES, self.site.config['FILES_FOLDERS']) 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. @@ -107,7 +112,7 @@ class BuildBundles(LateTask): utils.config_changed({ 1: kw, 2: file_dep - })], + }, 'nikola.plugins.task.bundles')], 'clean': True, } yield utils.apply_filters(task, kw['filters']) |
