diff --git a/assets/Readme.rst b/assets/Readme.rst index b3ca50a..c525e1b 100644 --- a/assets/Readme.rst +++ b/assets/Readme.rst @@ -89,6 +89,18 @@ LessCSS's binary: ASSET_CONFIG = (('closure_compressor_optimization', 'WHITESPACE_ONLY'), ('less_bin', 'lessc.cmd'), ) +If you wish to place your assets in locations other than the theme output +directory, you can use ``ASSET_SOURCE_PATHS`` in your settings file to provide +webassets with a list of additional directories to search, relative to the +theme's top-level directory. For example: + +.. code-block:: python + + ASSET_SOURCE_PATHS = ( + 'vendor/css', + 'scss', + ) + .. _Webassets: https://github.com/miracle2k/webassets .. _Webassets documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html .. _environment's register() method: http://webassets.readthedocs.org/en/latest/environment.html#registering-bundles diff --git a/assets/assets.py b/assets/assets.py index 52915a6..71b2ba2 100644 --- a/assets/assets.py +++ b/assets/assets.py @@ -53,6 +53,14 @@ def create_assets_env(generator): if logging.getLevelName(logger.getEffectiveLevel()) == "DEBUG": generator.env.assets_environment.debug = True + if 'ASSET_SOURCE_PATHS' in generator.settings: + # the default load path gets overridden if additional paths are + # specified, add it back + generator.env.assets_environment.append_path(assets_src) + for path in generator.settings['ASSET_SOURCE_PATHS']: + full_path = os.path.join(generator.theme, path) + generator.env.assets_environment.append_path(full_path) + def register(): """Plugin registration."""