diff --git a/hyde/ext/plugins/less.py b/hyde/ext/plugins/less.py index 4c574fe..adbff34 100644 --- a/hyde/ext/plugins/less.py +++ b/hyde/ext/plugins/less.py @@ -15,6 +15,8 @@ class LessCSSPlugin(CLTransformer): The plugin class for less css """ + default_app_path = "lessc" + def __init__(self, site): super(LessCSSPlugin, self).__init__(site) diff --git a/hyde/ext/plugins/uglify.py b/hyde/ext/plugins/uglify.py index 2e0ca6a..49a0097 100644 --- a/hyde/ext/plugins/uglify.py +++ b/hyde/ext/plugins/uglify.py @@ -11,6 +11,8 @@ class UglifyPlugin(CLTransformer): The plugin class for Uglify JS """ + default_app_path = "uglifyjs" + def __init__(self, site): super(UglifyPlugin, self).__init__(site) @@ -68,4 +70,4 @@ class UglifyPlugin(CLTransformer): self.call_app(args) out = target.read_all() - return out \ No newline at end of file + return out diff --git a/hyde/plugin.py b/hyde/plugin.py index ad8a7d0..7c494a3 100644 --- a/hyde/plugin.py +++ b/hyde/plugin.py @@ -220,6 +220,14 @@ class CLTransformer(Plugin): return {} + @property + def default_app_path(self): + """ + Default command line application path. Can be overridden + by specifying it in config. + """ + return self.plugin_name + @property def executable_not_found_message(self): """ @@ -253,15 +261,15 @@ class CLTransformer(Plugin): try: app_path = getattr(self.settings, 'app') except AttributeError: - raise self.template.exception_class( - self.executable_not_found_message) + app_path = self.default_app_path # Honour the PATH environment variable. - if not os.path.isabs(app_path): + if app_path is not None and not os.path.isabs(app_path): app_path = discover_executable(app_path) - if app_path is None: - raise self.template.exception_class( - self.executable_not_found_message) + + if app_path is None: + raise self.template.exception_class( + self.executable_not_found_message) app = File(app_path)