gruntjs - AngularJS html5Mode using Grunt connect. grunt 0.4.5 -
i switched on grunt 0.4.5 , changed how connect works.
i used connect-modrewrite , worked pretty (had issues urls generated /:parameter).
here old version worked grunt 0.4.1 generator-angular 0.8.0 middleware part modded me utilize html5mode.
connect: { options: { port: 9000, hostname: '*ip here*', livereload: 35729, middleware: function (connect, options) { var optbase = (typeof options.base === 'string') ? [options.base] : options.base; homecoming [require('connect-modrewrite')(['!(\\..+)$ / [l]'])].concat( optbase.map(function(path){ homecoming connect.static(path); }) ); } }, livereload: { options: { open: true, base: [ '.tmp', '<%= yeoman.app %>' ] } }, here new version generator-angular 0.9.0-1
connect: { options: { port: 9000, hostname: '*ip here*', livereload: 35729 }, livereload: { options: { open: true, middleware: function (connect) { homecoming [ connect.static('.tmp'), connect().use( '/bower_components', connect.static('./bower_components') ), connect.static(appconfig.app) ]; } } }, how can alter utilize mod-rewrite or other method accomplish html5mode?
i tried using method provided here: https://gist.github.com/nnarhinen/7719157 combined create following:
middleware: function (connect) { homecoming [ connect.static(modrewrite(['^[^\\.]*$ /index.html [l]'])), connect.static('.tmp'), connect().use( '/bower_components', connect.static('./bower_components') ), connect.static(appconfig.app) ]; } this allows me view normal view, modrewrite part not seem needs in order other view via url.
if else stumbles across here fix:
(the line added modrewrite line)
livereload: { options: { open: true, middleware: function (connect) { homecoming [ modrewrite(['^[^\\.]*$ /index.html [l]']), connect.static('.tmp'), connect().use( '/bower_components', connect.static('./bower_components') ), connect.static(appconfig.app) ]; } } }, make sure have next declared @ top of grunt file:
var modrewrite = require('connect-modrewrite'); angularjs gruntjs connect
No comments:
Post a Comment