Autorun Gulp task 'watch' on Webstorm launch

ε祈祈猫儿з 提交于 2019-12-08 04:03:53

问题


Is there a way to run a Gulp task on Webstorm launch?

Tried looking through webstorm settings but don't see anything, also Gulp integration is brand new to Webstorm 9.

gulp.task('watch', function () {

    gulp.watch(paths.watch.css, function(){ compileLESS(paths.src.css, paths.dest.css, {name: 'Style'}) });
    gulp.watch(paths.watch.cssBootstrap, function(){ compileLESS(paths.src.cssBootstrap ,paths.dest.cssBootstrap, {suffix: '.min', name: 'Bootstrap'}) });

    gulp.watch(paths.watch.scripts, ['scripts']);
    gulp.watch(paths.watch.libraries, ['libraries']);

});

Just want a way to run Gulp 'watch' (if the project has gulp and a task called watch) when ever i start Webstorm.


回答1:


No:( WebStorm (as well as other JetBrains IDEs) doesn't support 'on launch' actions - see https://youtrack.jetbrains.com/issue/WEB-11818#comment=27-787220




回答2:


As of WebStorm 11, this is possible.

  1. Settings > Tools > Startup Tasks
  2. Hit the green plus icon to Add New Configuration
  3. Choose Gulp.js
  4. Choose your tasks that you want to run from the Tasks: dropdown

Done!




回答3:


Best thing to do is set your gulp task (which sets up the watchers) as a 'before launch' task of your main configuration.

Works great for me. I need to start my server before I can start developing, and when I do, I know this will start my watchers and do any necessary processing for the first time.



来源:https://stackoverflow.com/questions/26484710/autorun-gulp-task-watch-on-webstorm-launch

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!