Buddyshot
Buddyshot

Reputation: 1684

Yeoman grunt build does not throw any warning/error but the resulting dist is not working

In an angular application, I either do grunt build or grunt serve:dist to build my production files and deploy them on a remote server. Everything looks fine and I can't see any warning message in the yeoman logs. yo doctor is also happy ("Everything looks all right!").

The problem is, whenever I go to my dist/index.html, I get the following message from the console:

Failed to load resource: the server responded with a status of 404 (Not Found). http://localhost:9000/components/portal/portal.html

Error: [$compile:tpload] Failed to load template: components/portal/portal.html

portal.html being the first template to be displayed in the app when it is not minified. I am surprised that the app is trying to get a resource in components/ since all the html should now be in dist/index.html right?

I am using Yeoman version 1.4.6 with the default GruntFile.js from the angular generator. More particularly, the build task is defined as follow:

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

What could possibly be the cause of my problem? Feel free to request more information.

Upvotes: 0

Views: 622

Answers (1)

Buddyshot
Buddyshot

Reputation: 1684

In the Gruntfile.js they say

// 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'

So the problem was that part of my project was located more than one level down the root. Changing {,*/}* by **/* in the tasks involved resolved the issue.

Upvotes: 1

Related Questions