【问题标题】:Use grunt-browser-sync to watch changes in jsp and tag files使用 grunt-browser-sync 观察 jsp 和标记文件的变化
【发布时间】:2017-05-29 12:34:36
【问题描述】:

我正在尝试使用 grunt-browser-sync 来查看 jsp 和标记文件中的更改,但同样不起作用。有人知道发生了什么吗? Grunt 可以处理标签和 jsp 文件吗?

 module.exports = function(grunt) {    
   // Project configuration.
   grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        watch: {   
           // hide code
        },   
        less: {
           // hide code
        },  
        // hide code
        browserSync: {
            default_options: {
                bsFiles: {
                    src: ["**/*.js", "*/*.css", "**/*.jsp", "**/*.tag" ]
                },
                options: {
                    watchTask: true,
                    proxy: "https://pageteste.local:9001/sitedeteste"
                }
            }
        }   
    });

    // Plugins
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks("grunt-browser-sync");

    // Browser sync task
    grunt.registerTask("server", ["browserSync", "watch"]);

    // Default task(s).
    grunt.registerTask('default', ['less', 'sprite', 'sync']);

};

【问题讨论】:

    标签: jsp gruntjs tags grunt-browser-sync


    【解决方案1】:

    您的通配模式使用错误:

             bsFiles: {
                    src: ["**/*.js", "*/*.css", "**/*.jsp", "**/*.tag" ]
                },
    

    【讨论】:

    • 我用这个更改更新了我的代码,但它仍然只适用于 .js 文件。 browserSync: { default_options: { bsFiles: { src: ["**/*.js", "*/*.css", "**/*.jsp", "**/*.tag" ] }, options: { watchTask: true, proxy: "https://pageteste.local:9001/sitedeteste" } } }
    【解决方案2】:

    我需要为此更改我的代码路径:

    bsFiles: {
        src: [
            "web/path/**/*.js", 
            "web/path/css/style.css",
            "web/**/*.jsp", 
            "web/webroot/path/**/*.tag", 
        ]
    },
    

    【讨论】:

      猜你喜欢
      • 2012-09-30
      • 2014-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多