nicosantangelo / sublime-gulp

Run Gulp tasks and use snippets from Sublime Text
https://sublime-gulp.nicosantangelo.com/
MIT License
155 stars 18 forks source link

shortcut key problem #68

Open iamaddy opened 8 years ago

iamaddy commented 8 years ago

when I bind the shortcut key like this: [{"keys": ["f4"], "command": "gulp", "args": { "task_name": "detault" }}] I press f4,the log show“ can't find the gulpfile”,because it will directly find gulpfile from root path. so I add some code like this in base_command.py

def run(self, task_name=None, task_flag=None, silent=False, paths=[]):
        self.setup_data_from_settings()
        self.task_name = task_name

        self.task_flag = task_flag if task_name is not None and task_flag is not None else self.get_flag_from_task_name()
        self.silent = silent
        self._working_dir = ""
        view = sublime.active_window().active_view()
        if len(paths) < 1:
            paths= [view.file_name()]

        self.sercheable_folders = [os.path.dirname(path) for path in paths] if len(paths) > 0 else self.window.folders()
        self.output_view = None
        self.work()

after this, it will find gulpfile from active_view

nicosantangelo commented 8 years ago

Hello, thanks for the feedback!

I'm not sure if I understood you correctly but it seems like you can solve this problem using gulpfile_paths and maybe per project settings

Let me know if I'm missing the mark here