return [
                    self._asset_cache.get_url(JavascriptAsset(
                        list(map(AdaptiveAsset, assets)), compile, rescope),
                                              force_save=True)
                ]
            return []
        return [self._asset_cache.get_url(asset) for asset in assets]


# The default javascript cache.
default_javascript_cache = JavascriptCache()

# Asset compiler plugin.


class JavascriptAssetCompilerPlugin(AssetCompilerPluginBase):
    """An asset compiler plugin for javascript files."""

    asset_type = "javascript"

    def __init__(self, javascript_cache=default_javascript_cache):
        """Initialzies the javascript asset compiler plugin."""
        self._javascript_cache = javascript_cache

    def compile_assets(self, assets):
        """Compiles the given javascript assets."""
        self._javascript_cache.get_urls(assets, force_save=True)


default_asset_compiler.register_plugin("js", JavascriptAssetCompilerPlugin())
            force_save = not settings.DEBUG
        if force_save:
            if assets:
                return [self._asset_cache.get_url(StylesheetAsset(map(AdaptiveAsset, assets), compile), force_save=True)]    
            return []
        return [self._asset_cache.get_url(asset) for asset in assets]
        
        
# The default stylesheet cache.
default_stylesheet_cache = StylesheetCache()


# Asset compiler plugin.

class StylesheetAssetCompilerPlugin(AssetCompilerPluginBase):
    
    """An asset compiler plugin for stylesheet files."""
    
    asset_type = "stylesheet"
    
    def __init__(self, stylesheet_cache=default_stylesheet_cache):
        """Initialzies the stylesheet asset compiler plugin."""
        self._stylesheet_cache = stylesheet_cache
        
    def compile_assets(self, assets):
        """Compiles the given stylesheet assets."""
        self._stylesheet_cache.get_urls(assets, force_save=True)
        

default_asset_compiler.register_plugin("css", StylesheetAssetCompilerPlugin())
Example #3
0
                return [
                    self._asset_cache.get_url(StylesheetAsset(
                        list(map(AdaptiveAsset, assets)), compile),
                                              force_save=True)
                ]
            return []
        return [self._asset_cache.get_url(asset) for asset in assets]


# The default stylesheet cache.
default_stylesheet_cache = StylesheetCache()

# Asset compiler plugin.


class StylesheetAssetCompilerPlugin(AssetCompilerPluginBase):
    """An asset compiler plugin for stylesheet files."""

    asset_type = "stylesheet"

    def __init__(self, stylesheet_cache=default_stylesheet_cache):
        """Initialzies the stylesheet asset compiler plugin."""
        self._stylesheet_cache = stylesheet_cache

    def compile_assets(self, assets):
        """Compiles the given stylesheet assets."""
        self._stylesheet_cache.get_urls(assets, force_save=True)


default_asset_compiler.register_plugin("css", StylesheetAssetCompilerPlugin())
                        JavascriptAsset(list(map(AdaptiveAsset, assets)), compile, rescope), force_save=True
                    )
                ]
            return []
        return [self._asset_cache.get_url(asset) for asset in assets]


# The default javascript cache.
default_javascript_cache = JavascriptCache()


# Asset compiler plugin.


class JavascriptAssetCompilerPlugin(AssetCompilerPluginBase):

    """An asset compiler plugin for javascript files."""

    asset_type = "javascript"

    def __init__(self, javascript_cache=default_javascript_cache):
        """Initialzies the javascript asset compiler plugin."""
        self._javascript_cache = javascript_cache

    def compile_assets(self, assets):
        """Compiles the given javascript assets."""
        self._javascript_cache.get_urls(assets, force_save=True)


default_asset_compiler.register_plugin("js", JavascriptAssetCompilerPlugin())