def reload(self): """Call while config file changed need build all css js file """ self.config = load_yaml(self.config_file) self.file_list = {} for target, sources in self.config.items(): target_file = os.path.join(self.root_path, target) self.file_list[target_file] = target for source in sources: self.file_list[os.path.join(self.root_path, source)] = target log.info("-" * 80) log.info("load css js build config") # use new process run long time job, Otherwise Observer process well interrupt. new_process = Process(target=self._build_css_js, args=(self.config,), daemon=False) new_process.start()
def get_config(path, file_name): config_file = os.path.join(path, file_name) if not os.path.exists(config_file): raise Exception('config file [%s] not exists.' % config_file) return load_yaml(config_file)