angularjs - Angular-Fullstack - grunt build not including javascript files -
ok post question on angular-fullstack's issue list on github can check out there see if there additional posts aren't on here. git hub question
basically i'm getting next output in console:
get http://localhost:8080/assets/images/loading.gif 404 (not found) (index):60 http://localhost:8080/app/assignment-meeting/prepare-senior/candidate/profile/_profile-ctrl.js (index):102 http://localhost:8080/app/assignment-meeting/prepare-senior/candidate-list/candidates-list-controller.js (index):100 http://localhost:8080/app/assignment-meeting/prepare-senior/candidate/_candidate-ctrl.js (index):101 http://localhost:8080/app/assignment-meeting/prepare-senior/candidate/summary/_summary-ctrl.js (index):103 http://localhost:8080/app/home/home-controller.js (index):104 http://localhost:8080/components/services/candidate-services.js (index):109 http://localhost:8080/components/auth/user.js (index):106 http://localhost:8080/app/routes.js (index):105 http://localhost:8080/components/directives/napi-ck-editor.js (index):108 http://localhost:8080/components/auth/user-service.js (index):107 http://localhost:8080/components/services/http-helper.js (index):110 http://localhost:8080/components/services/menu-services.js 404 (not found)
it seems grunt build can't find script files located within injector sections of index.html page. if recopy created index.html file generator created , re-create of code above "google analytics" section over, work fine. don't understand why doesn't work doesn't seem show there beingness actual difference in code. page doesn't show single line beingness different. thing thought might causing problem line endings might getting changed when commit git , has issues. truthfully i'm in dark on one. post question on couple different forms i'm tired of retyping it...so if want read git hub post (link above), might improve worded.
thanks help.
update:
sorry should have attached grunt file read , noted there's grunt.registertask called "build." didn't attach because haven't changed default 1 made angular-fullstack , figure other view reference...but attaching simpler , better:
'use strict'; module.exports = function (grunt) { // configurable paths application var appconfig = { app: require('./bower.json').apppath || 'client', dist: 'src/main/webapp' }; // load grunt tasks automatically, when needed require('jit-grunt')(grunt, { useminprepare: 'grunt-usemin', ngtemplates: 'grunt-angular-templates', cdnify: 'grunt-google-cdn', protractor: 'grunt-protractor-runner', injector: 'grunt-asset-injector' }); // require('load-grunt-tasks')(grunt); // time how long tasks take. can help when optimizing build times require('time-grunt')(grunt); // define configuration tasks grunt.initconfig({ // project settings pkg: grunt.file.readjson('package.json'), yeoman: { // configurable paths client: require('./bower.json').apppath || 'client', dist: 'src/main/webapp' }, watch: { bower: { files: ['bower.json'], tasks: ['wiredep'] }, injectjs: { files: [ '<%= yeoman.client %>/{app,components}/**/*.js', '!<%= yeoman.client %>/{app,components}/**/*.spec.js', '!<%= yeoman.client %>/{app,components}/**/*.mock.js', '!<%= yeoman.client %>/app/app.js'], tasks: ['injector:scripts'] }, injectcss: { files: [ '<%= yeoman.client %>/{app,components}/**/*.css' ], tasks: ['injector:css'] }, jstest: { files: [ '<%= yeoman.client %>/{app,components}/**/*.spec.js', '<%= yeoman.client %>/{app,components}/**/*.mock.js' ], tasks: ['newer:jshint:all', 'karma'] }, injectsass: { files: [ '<%= yeoman.client %>/{app,components}/**/*.{scss,sass}'], tasks: ['injector:sass'] }, sass: { files: [ '<%= yeoman.client %>/{app,components}/**/*.{scss,sass}'], tasks: ['sass', 'autoprefixer'] }, gruntfile: { files: ['gruntfile.js'] }, livereload: { files: [ '{.tmp,<%= yeoman.client %>}/{app,components}/**/*.css', '{.tmp,<%= yeoman.client %>}/{app,components}/**/*.html', '{.tmp,<%= yeoman.client %>}/{app,components}/**/*.js', '!{.tmp,<%= yeoman.client %>}{app,components}/**/*.spec.js', '!{.tmp,<%= yeoman.client %>}/{app,components}/**/*.mock.js', '<%= yeoman.client %>/assets/images/{,*//*}*.{png,jpg,jpeg,gif,webp,svg}' ], options: { livereload: true } } }, // actual grunt server settings connect: { options: { port: 9000, // alter '0.0.0.0' access server outside. hostname: 'localhost' }, livereload: { options: { open: true, middleware: function (connect) { homecoming [ connect.static('.tmp'), connect().use( '/client/bower_components', connect.static('./client/bower_components') ), connect.static(appconfig.app) ]; } } }, test: { options: { port: 9001, middleware: function (connect) { homecoming [ connect.static('.tmp'), connect.static('test'), connect().use( '/client/bower_components', connect.static('./client/bower_components') ), connect.static(appconfig.app) ]; } } }, dist: { options: { open: true, base: '<%= yeoman.dist %>' } } }, // create sure code styles par , there no obvious mistakes jshint: { options: { jshintrc: '<%= yeoman.client %>/.jshintrc', reporter: require('jshint-stylish') }, all: [ '<%= yeoman.client %>/{app,components}/**/*.js', '!<%= yeoman.client %>/{app,components}/**/*.spec.js', '!<%= yeoman.client %>/{app,components}/**/*.mock.js' ], test: { src: [ '<%= yeoman.client %>/{app,components}/**/*.spec.js', '<%= yeoman.client %>/{app,components}/**/*.mock.js' ] } }, // empties folders start fresh clean: { dist: { files: [{ dot: true, src: [ '.tmp', '<%= yeoman.dist %>/*', '!<%= yeoman.dist %>/.git*', '!<%= yeoman.dist %>/.openshift', '!<%= yeoman.dist %>/procfile' ] }] }, server: '.tmp' }, // add together vendor prefixed styles autoprefixer: { options: { browsers: ['last 1 version'] }, dist: { files: [{ expand: true, cwd: '.tmp/', src: '{,*/}*.css', dest: '.tmp/' }] } }, // automatically inject bower components app wiredep: { target: { src: '<%= yeoman.client %>/index.html', ignorepath: '<%= yeoman.client %>/', exclude: [/bootstrap-sass-official/, /bootstrap.js/, '/json3/', '/es5-shim/', /bootstrap.css/, /font-awesome.css/ ] } }, // renames files browser caching purposes rev: { dist: { files: { src: [ '<%= yeoman.dist %>/public/{,*/}*.js', '<%= yeoman.dist %>/public/{,*/}*.css', '<%= yeoman.dist %>/public/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}', '<%= yeoman.dist %>/public/assets/fonts/*' ] } } }, // reads html usemin blocks enable smart builds automatically // concat, minify , revision files. creates configurations in memory // additional tasks can operate on them useminprepare: { html: ['<%= yeoman.client %>/index.html'], options: { dest: '<%= yeoman.dist %>/public', flow: { html: { steps: { js: ['concat', 'uglifyjs'], css: ['cssmin'] }, post: {} } } } }, cssmin: { options: { root: 'client' } }, // performs rewrites based on rev , useminprepare configuration usemin: { html: ['<%= yeoman.dist %>/public/{,*/}*.html'], css: ['<%= yeoman.dist %>/public/{,*/}*.css'], js: ['<%= yeoman.dist %>/public/{,*/}*.js'], options: { assetsdirs: [ '<%= yeoman.dist %>/public', '<%= yeoman.dist %>/public/assets/images' ], // update image references in our ng-templates patterns: { js: [ [/(assets\/images\/.*?\.(?:gif|jpeg|jpg|png|webp|svg))/gm, 'update js reference our revved images'] ] } } }, // next *-min tasks produce minified files in dist folder imagemin: { dist: { files: [{ expand: true, cwd: '<%= yeoman.client %>/assets/images', src: '{,*/}*.{png,jpg,jpeg,gif}', dest: '<%= yeoman.dist %>/public/assets/images' }] } }, // htmlmin: { // dist: { // options: { // collapsewhitespace: true, // conservativecollapse: true, // collapsebooleanattributes: true, // removecommentsfromcdata: true, // removeoptionaltags: true // }, // files: [{ // expand: true, // cwd: '<%= yeoman.dist %>', // src: ['*.html', 'app/**/*.html'], // dest: '<%= yeoman.dist %>' // }] // } // }, // uglify: { // dist: { // files: { // '<%= yeoman.dist %>/scripts/scripts.js': [ // '<%= yeoman.dist %>/scripts/scripts.js' // ] // } // } // }, svgmin: { dist: { files: [{ expand: true, cwd: '<%= yeoman.client %>/assets/images', src: '{,*/}*.svg', dest: '<%= yeoman.dist %>/public/assets/images' }] } }, // allow utilize of non-minsafe angularjs files. automatically makes // minsafe compatible uglify not destroy ng references ngannotate: { dist: { files: [{ expand: true, cwd: '.tmp/concat', src: '*/**.js', dest: '.tmp/concat' }] } }, // bundle html partials single javascript payload ngtemplates: { options: { // should name of apps angular module module: 'napirest', htmlmin: { collapsebooleanattributes: true, collapsewhitespace: true, removeattributequotes: true, removeemptyattributes: true, removeredundantattributes: true, removescripttypeattributes: true, removestylelinktypeattributes: true }, usemin: 'app/app.js' }, main: { cwd: '<%= yeoman.client %>', src: ['{app,components}/**/*.html'], dest: '.tmp/templates.js' }, tmp: { cwd: '.tmp', src: ['{app,components}/**/*.html'], dest: '.tmp/tmp-templates.js' } }, // replace google cdn references cdnify: { dist: { html: ['<%= yeoman.dist %>/public/*.html'] } }, // copies remaining files places other tasks can utilize copy: { dist: { files: [{ expand: true, dot: true, cwd: '<%= yeoman.client %>', dest: '<%= yeoman.dist %>/public', src: [ '*.{ico,png,txt}', '.htaccess', 'bower_components/**/*', 'assets/images/{,*/}*.{webp}', 'assets/fonts/**/*', 'index.html' ] }, { expand: true, cwd: '.tmp/images', dest: '<%= yeoman.dist %>/public/assets/images', src: ['generated/*'] }, { expand: true, dest: '<%= yeoman.dist %>', src: [ 'package.json' ] }] }, styles: { expand: true, cwd: '<%= yeoman.client %>', dest: '.tmp/', src: ['{app,components}/**/*.css'] } }, // run tasks in parallel speed build process concurrent: { server: [ 'sass' ], test: [ 'sass' ], dist: [ 'sass', 'imagemin', 'svgmin' ] }, // test settings karma: { unit: { configfile: 'karma.conf.js', singlerun: true } }, mochatest: { options: { reporter: 'spec' }, src: ['server/**/*.spec.js'] }, protractor: { options: { configfile: 'protractor.conf.js' }, chrome: { options: { args: { browser: 'chrome' } } } }, // compiles sass css sass: { server: { options: { loadpath: [ '<%= yeoman.client %>/bower_components', '<%= yeoman.client %>/app', '<%= yeoman.client %>/components' ], compass: false }, files: { '.tmp/app/app.css' : '<%= yeoman.client %>/app/app.scss' } } }, injector: { options: { }, // inject application script files index.html (doesn't include bower) scripts: { options: { transform: function(filepath) { filepath = filepath.replace('/client/', ''); filepath = filepath.replace('/.tmp/', ''); homecoming '<script src="' + filepath + '"></script>'; }, starttag: '<!-- injector:js -->', endtag: '<!-- endinjector -->' }, files: { '<%= yeoman.client %>/index.html': [ ['{.tmp,<%= yeoman.client %>}/{app,components}/**/*.js', '!{.tmp,<%= yeoman.client %>}/app/app.js', '!{.tmp,<%= yeoman.client %>}/{app,components}/**/*.spec.js', '!{.tmp,<%= yeoman.client %>}/{app,components}/**/*.mock.js'] ] } }, // inject component scss app.scss sass: { options: { transform: function(filepath) { filepath = filepath.replace('/client/app/', ''); filepath = filepath.replace('/client/components/', ''); homecoming '@import \'' + filepath + '\';'; }, starttag: '// injector', endtag: '// endinjector' }, files: { '<%= yeoman.client %>/app/app.scss': [ '<%= yeoman.client %>/{app,components}/**/*.{scss,sass}', '!<%= yeoman.client %>/app/app.{scss,sass}' ] } }, // inject component css index.html css: { options: { transform: function(filepath) { filepath = filepath.replace('/client/', ''); filepath = filepath.replace('/.tmp/', ''); homecoming '<link rel="stylesheet" href="' + filepath + '">'; }, starttag: '<!-- injector:css -->', endtag: '<!-- endinjector -->' }, files: { '<%= yeoman.client %>/index.html': [ '<%= yeoman.client %>/{app,components}/**/*.css' ] } } } }); // used delaying livereload until after server has restarted grunt.registertask('wait', function () { grunt.log.ok('waiting server reload...'); var done = this.async(); settimeout(function () { grunt.log.writeln('done waiting!'); done(); }, 3000); }); grunt.registertask('serve', function (target) { if (target === 'dist') { homecoming grunt.task.run(['build', 'wait', 'connect:dist:keepalive']); } grunt.task.run([ 'clean:server', 'injector:sass', 'concurrent:server', 'injector', 'wiredep', 'autoprefixer', 'connect:livereload', 'wait', 'watch' ]); }); grunt.registertask('server', function () { grunt.log.warn('the `server` task has been deprecated. utilize `grunt serve` start server.'); grunt.task.run(['serve']); }); grunt.registertask('test', function(target) { if (target === 'client') { homecoming grunt.task.run([ 'clean:server', 'injector:sass', 'concurrent:test', 'injector', 'autoprefixer', 'karma' ]); } else if (target === 'e2e') { homecoming grunt.task.run([ 'clean:server', 'injector:sass', 'concurrent:test', 'injector', 'wiredep', 'autoprefixer', 'connect:test', 'protractor' ]); } else grunt.task.run([ 'test:client' ]); }); grunt.registertask('build', [ 'clean:dist', 'injector:sass', 'concurrent:dist', 'injector', 'wiredep', 'useminprepare', 'autoprefixer', 'ngtemplates', 'concat', 'ngannotate', 'copy:dist', 'cdnify', 'cssmin', 'uglify', 'rev', 'usemin' ]); grunt.registertask('default', [ 'newer:jshint', 'test', 'build' ]); };
i've encountered xactly same problem here. after hours of file file comparison. i've solved it. thought share has worked me.
i'm working on windows, , alter line ending unix style "index.html" in text editor (i'm using sublime text way) solve problem. "windows" line ending create script bug seems.
hope help.
meg4mi
javascript angularjs gruntjs bower
No comments:
Post a Comment