angularjs - grunt bowerInstall not working -
i'm setting new angularjs project (first time me) , i'm finding touchy... latest issue getting bower configure things in index.html file.
if hardcode things googleapis, works fine (example in index.html file).
if setup bower , grunt bowerinstall, adds correct lines in index.html don't work @ all. errors like:
resource interpreted script transferred mime type text/html: "http://localhost:8081/bower_components/angular/angular.js". and uncaught syntaxerror: unexpected token < angular files.
so far bower has been royal pain... ideas what's going wrong here? thanks!
btw, simple app working expected , i've gotten basic karma tests working.
bower.json:
{ "name": "meanjs_book", "version": "0.1.0", "homepage": "https://github.com/jesii/xxx", "authors": [ "jon seidel <jseidel@edpci.com>" ], "description": "rudimentary app meanjs book", "main": "server.js", "moduletype": [ "node" ], "keywords": [ "mongodb", "express", "angularjs", "node", "highplans" ], "license": "mit", "private": true, "ignore": [ "**/.*", "node_modules", "bower_components", "test", "tests", "spec" ], "dependencies": { "angular-route": "~1.3.15", "angular": "~1.3.15", "angular-animate": "~1.3.15", "angular-mocks": "~1.3.15" } } gruntfile
module.exports = function(grunt) { // project configuration. grunt.initconfig({ pkg: grunt.file.readjson('package.json'), uglify: { options: { banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' }, build: { src: 'src/<%= pkg.name %>.js', dest: 'build/<%= pkg.name %>.min.js' } }, bowerinstall: { target: { // point files should updated when // run `grunt bowerinstall` src: ['public/app/views/index.html'], // index.html support // optional: // --------- cwd: '', dependencies: true, devdependencies: false, exclude: [], filetypes: {}, ignorepath: '', overrides: {} } } }); // load plugin provides "uglify" task. grunt.loadnpmtasks('grunt-contrib-uglify'); // default task(s). grunt.registertask('default', ['uglify']); grunt.loadnpmtasks('grunt-bower-install'); }; index.html:
<!-- angularjs --> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js" type="text/javascript" charset="utf-8"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-route.js" type="text/javascript" charset="utf-8"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.js" type="text/javascript" charset="utf-8"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-mocks.js" type="text/javascript" charset="utf-8"></script> <!-- bower:js --> <!-- <script src="../../../bower_components/angular/angular.js" type="text/javascript"></script> --> <!-- <script src="../../../bower_components/angular-route/angular-route.js" type="text/javascript"></script> --> <!-- <script src="../../../bower_components/angular-animate/angular-animate.js" type="text/javascript"></script> --> </script> -->
i'm assuming you're getting error when running grunt serve. console message pasted indicates grunt isn't allowing js files through. if particular file type isn't allowed, it's replaced index.html why transferred mime type html. did gruntfile from?
additionally, recommend using yeoman scaffold basic angular app. check out here: http://yeoman.io/codelab.html. it's easy follow , make more comfortable using tools grunt & bower.
Comments
Post a Comment