예제 #1
0
파일: watch.py 프로젝트: pylover/isass
    def add_output(self, outfiles, dirs=None, files=None, lib_dirs=None):

        if isinstance(outfiles, basestring):
            outfiles = {'normal': outfiles}

        if dirs is None:
            dirs = []

        if files is None:
            files = []

        if lib_dirs is None:
            lib_dirs = []

        dirs = distinct(split_paths(dirs))

        handler = IsassEventHandler(outfiles, dirs, files=files, lib_dirs=lib_dirs)
        watch_dirs = list(dirs)

        if lib_dirs:
            watch_dirs += split_paths(lib_dirs)
        if files:
            watch_dirs += split_paths([os.path.dirname(p) for p in files])

        watch_dirs = [wd for wd in distinct(watch_dirs) if os.path.exists(wd)]

        handler.write_out()
        for d in watch_dirs:
            self.schedule(handler, d, recursive=False)
예제 #2
0
파일: watch.py 프로젝트: pylover/isass
    def on_any_event(self, event):
        paths = []
        if hasattr(event, 'src_path'):
            paths += split_paths(event.src_path)
        if hasattr(event, 'dest_path'):
            paths += split_paths(event.dest_path)

        if self.manifest.is_paths_in_task(self.taskname, paths):
            self.write_out()
예제 #3
0
파일: watch.py 프로젝트: pylover/isass
    def on_any_event(self, event):
        paths = []
        if hasattr(event, 'src_path'):
            paths += split_paths(event.src_path)
        if hasattr(event, 'dest_path'):
            paths += split_paths(event.dest_path)

        changed = False
        for p in paths:
            if p in self.source_files:
                changed = True
                break

            if os.path.abspath(os.path.dirname(p)) in self.lib_dirs and p.endswith(self.extension):
                changed = True
                break

        if changed:
            # One or more sass file changes, trying to regenerate output
            self.write_out()