Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何删除gulp注入脚本路径中的路径前缀?_Javascript_Maven_Gulp_Wiredep_Grunt Wiredep - Fatal编程技术网

Javascript 如何删除gulp注入脚本路径中的路径前缀?

Javascript 如何删除gulp注入脚本路径中的路径前缀?,javascript,maven,gulp,wiredep,grunt-wiredep,Javascript,Maven,Gulp,Wiredep,Grunt Wiredep,我用过maven和gulp。在maven中,gulp的注入任务在包装罐子时调用。我已经在项目中的spring引导结构的src/main/resources/static/中放置了静态文件。打包jar后,index.html文件如下所示: <!-- build:js js/app.js --> <!--inject:js --> <script src="src/main/resources/static/app/.................js"><

我用过maven和gulp。在maven中,gulp的注入任务在包装罐子时调用。我已经在项目中的spring引导结构的
src/main/resources/static/
中放置了静态文件。打包jar后,
index.html
文件如下所示:

<!-- build:js js/app.js -->
<!--inject:js -->
<script src="src/main/resources/static/app/.................js"></script>
<!--endinject -->
<!--endbuild -->
和gulp.config.js中的配置:

var config = {
    buildPath:'',
    styles:[],
    indexPage: client + "index.html",
    browserSync:{
        proxy: 'localhost:' + port,
        port: 3000,
        files: ['**/*.*'],
        ghostMode: { // these are the defaults t,f,t,t
            clicks: true,
            location: false,
            forms: true,
            scroll: true
        },
        logLevel: 'debug',
        logPrefix: 'gulp-patterns',
        notify: true,
        reloadDelay: 1000
    },
    bower: {
        json: require('./bower.json'),
        directory: client+'vendors',
        ignorePath: './../../'
    },
    jsSources: {
        client: client + "app/**/*.js",
        exclude: "!vendors/**/*.js",
        sundry: ['./gulpfile.js', './gulpfile.config.js'],
        injectable: [
            scriptPath + '/quick-sidebar.js',
            scriptPath + '/demo.js',
            scriptPath + '/layout.js',
            scriptPath + '/metronic.js',
            client + 'app/**/*.module.js',
            client + 'app/**/*.js',
            '!' + client + '/app/**/*.spec.js',
        ]
    },
};

通过使用
src/main/resources/static
在gulp.file.js中设置ignorePath,它将在index.html中删除前缀路径,而这一前缀路径远远低于一个路径

    gulp.src(['app/client/public/index.html']) 
     .pipe(inject(gulp.src(['app/client/public/js/**/*.js','app/client/public/app.js'],{read: false} ),
      {addRootSlash : true,ignorePath:'/app/client/public'}))
    gulp.src(['app/client/public/index.html']) 
     .pipe(inject(gulp.src(['app/client/public/js/**/*.js','app/client/public/app.js'],{read: false} ),
      {addRootSlash : true,ignorePath:'/app/client/public'}))