【问题标题】:grunt-localscreenshots is getting Not Found error on rendered pages from grunt-contrib-connectgrunt-localscreenshots 在来自 grunt-contrib-connect 的渲染页面上出现 Not Found 错误
【发布时间】:2016-11-09 16:28:38
【问题描述】:

我有一种情况,我正在使用 grunt-contrib-connect 将文件提供给 grunt-localscreenshots。问题是在 localscreenshots 的输出中,所有图像都有服务器错误“未找到”。

如果我使用 keepalive 选项访问服务器,我可以导航到目录中的任何文件。

我看到的唯一似乎具有暗示性的细节是,在运行连接时的终端输出中,“文件:[无文件]”在连接输出中。

这是我的 gruntfile 的精简版本,它重现了问题。

//start gruntfile
module.exports = function(grunt) {

// measures the time each task takes
require('time-grunt')(grunt);
var path = require('path'),
    argv = require('minimist')(process.argv.slice(2));

// load all grunt tasks
grunt.loadNpmTasks('grunt-localscreenshots');
grunt.loadNpmTasks('grunt-contrib-connect');


grunt.initConfig({

    localscreenshots: {
        options: {
            path: './release/screenshots',
            type: 'png',
            local: {
                path: './release',
                port: 8080
            },
            viewport: ['600x800', '768x1024', '1024x1024'],
        },
        src: ['release/*.html']
    },

    //task specific server
    connect: {
        server: {
            options: {
                port: 8080,
                base: ['./release/'],
                //keepalive: true,
                //open: true
            }
        }
    }
});

 grunt.registerTask('test', ['connect', 'localscreenshots']);
};

还有我的目录结构... 哎呀,还不能发图。这是图片的链接。

https://drive.google.com/open?id=0B4bxMjEzI-oKTkM3YjNvT2lnZW8

提前感谢任何人都可以对此有所了解。

【问题讨论】:

    标签: javascript node.js gruntjs grunt-contrib-connect


    【解决方案1】:

    简单的答案是不要过度考虑你的路径,我指定的是“./release”等等,这会让事情变得一团糟。

    【讨论】:

      猜你喜欢
      • 2015-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-12
      • 2015-08-24
      • 1970-01-01
      • 2015-11-13
      • 2016-03-13
      相关资源
      最近更新 更多