Merge pull request #51 from malept/assets/source-paths
Assets: add support for specifying additional source load paths
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user