【问题标题】:How can I use grunt to open Google Chrome and pass flags like --incognito?如何使用 grunt 打开 Google Chrome 并传递 --incognito 之类的标志?
【发布时间】:2016-08-11 03:05:07
【问题描述】:

我正在为本地开发服务器使用 grunt-contrib-connect,并且想编写一个任务以在服务器启动后启动 google chrome。但是想要传递以下参数以在不安全模式下打开它。

--args --disable-web-security --user-data-dir

我尝试使用 grunt-open 来执行此操作,但没有找到任何传递标志的选项。

感谢任何帮助。

【问题讨论】:

    标签: gruntjs grunt-contrib-connect


    【解决方案1】:

    您应该能够使用grunt-exec 来做您需要的事情。这样的配置对我有用:

    grunt.config.init({
        ...
        exec: {
            chrome: {
                cmd: '"C:/Program Files (x86)/Google/Chrome/Application/chrome" --incognito http://washingtonpost.com'
            }
        }
        ...
    });
    

    请注意,在 Windows 上,可执行文件的路径需要引号。如果你有幸使用了不那么烦人的操作系统,你就不需要它们了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-09-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-22
      • 2021-04-21
      相关资源
      最近更新 更多