【问题标题】:Yeoman grunt build does not throw any warning/error but the resulting dist is not workingYeoman grunt build 不会引发任何警告/错误,但生成的 dist 无法正常工作
【发布时间】:2015-05-08 19:51:20
【问题描述】:

在 Angular 应用程序中,我使用 grunt buildgrunt serve:dist 来构建我的生产文件并将它们部署在远程服务器上。一切看起来都很好,我在 yeoman 日志中看不到任何警告消息。 yo doctor 也很高兴(“一切看起来都很好!”)。

问题是,每当我访问我的dist/index.html 时,我都会从控制台收到以下消息:

加载资源失败:服务器响应状态为 404 (未找到)。 http://localhost:9000/components/portal/portal.html

错误:[$compile:tpload] 加载模板失败: 组件/门户/portal.html

portal.html 是应用中未缩小时显示的第一个模板。我很惊讶该应用程序正试图在 components/ 中获取资源,因为所有 html 现在都应该在 dist/index.html 中,对吧?

我正在使用 Yeoman 1.4.6 版和来自 angular 生成器的默认 GruntFile.js。更具体地说,build 任务定义如下:

grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngAnnotate',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'filerev',
    'usemin',
    'htmlmin'
  ]);

什么可能是我的问题的原因?随时索取更多信息。

【问题讨论】:

    标签: angularjs gruntjs yeoman


    【解决方案1】:

    Gruntfile.js他们说

    // for performance reasons we're only matching one level down:
    // 'test/spec/{,*/}*.js'
    // use this if you want to recursively match all subfolders:
    // 'test/spec/**/*.js'
    

    所以问题是我的项目的一部分位于根目录的不止一层。在所涉及的任务中将{,*/}* 更改为**/* 解决了该问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-02-15
      • 2017-01-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-04
      • 2016-05-05
      相关资源
      最近更新 更多