diff --git a/1029.diff b/1029.diff new file mode 100644 index 000000000..3fbe94767 --- /dev/null +++ b/1029.diff @@ -0,0 +1,164 @@ +diff --git a/templates/common/root/_Gruntfile.js b/templates/common/root/_Gruntfile.js +index a715598..f966742 100644 +--- a/templates/common/root/_Gruntfile.js ++++ b/templates/common/root/_Gruntfile.js +@@ -43,10 +43,7 @@ module.exports = function (grunt) { + },<% } else { %> + js: { + files: ['<%%= yeoman.app %>/scripts/{,*/}*.js'], +- tasks: ['newer:jshint:all'], +- options: { +- livereload: '<%%= connect.options.livereload %>' +- } ++ tasks: ['newer:jshint:all'] + }, + jsTest: { + files: ['test/spec/{,*/}*.js'], +@@ -64,9 +61,6 @@ module.exports = function (grunt) { + files: ['Gruntfile.js'] + }, + livereload: { +- options: { +- livereload: '<%%= connect.options.livereload %>' +- }, + files: [ + '<%%= yeoman.app %>/{,*/}*.html', + '.tmp/styles/{,*/}*.css',<% if (coffee) { %> +@@ -77,52 +71,51 @@ module.exports = function (grunt) { + }, + + // The actual grunt server settings +- connect: { +- options: { +- port: 9000, +- // Change this to '0.0.0.0' to access the server from outside. +- hostname: 'localhost', +- livereload: 35729 +- }, ++ browserSync: { + livereload: { ++ bsFiles: { ++ src: [ ++ '<%%= yeoman.app %>/{,*/}*.html', ++ '.tmp/styles/{,*/}*.css', ++ '<%%= yeoman.app %>/scripts/{,*/}*.js', ++ '<%%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}' ++ ] ++ }, + options: { +- open: true, +- middleware: function (connect) { +- return [ +- connect.static('.tmp'), +- connect().use( +- '/bower_components', +- connect.static('./bower_components') +- ), +- connect().use( +- '/app/styles', +- connect.static('./app/styles') +- ), +- connect.static(appConfig.app) +- ]; ++ watchTask: true, ++ server: { ++ baseDir: [appConfig.app, '.tmp'], ++ routes: { ++ '/bower_components': 'bower_components' ++ } + } + } + }, +- test: { ++ dist: { ++ bsFiles: { ++ src: '<%%= yeoman.dist %>/{,*/}*.html' ++ }, + options: { +- port: 9001, +- middleware: function (connect) { +- return [ +- connect.static('.tmp'), +- connect.static('test'), +- connect().use( +- '/bower_components', +- connect.static('./bower_components') +- ), +- connect.static(appConfig.app) +- ]; ++ server: { ++ baseDir: appConfig.dist + } + } + }, +- dist: { ++ test: { ++ bsFiles: { ++ src: 'test/spec/{,*/}*.js' ++ }, + options: { +- open: true, +- base: '<%%= yeoman.dist %>' ++ watchTask: true, ++ port: 9001, ++ open: false, ++ logLevel: 'silent', ++ server: { ++ baseDir: ['test', '.tmp', appConfig.app], ++ routes: { ++ '/bower_components': 'bower_components' ++ } ++ } + } + } + }, +@@ -489,9 +482,9 @@ module.exports = function (grunt) { + }); + + +- grunt.registerTask('serve', 'Compile then start a connect web server', function (target) { ++ grunt.registerTask('serve', 'Compile then start a BrowserSync web server', function (target) { + if (target === 'dist') { +- return grunt.task.run(['build', 'connect:dist:keepalive']); ++ return grunt.task.run(['build', 'browserSync:dist']); + } + + grunt.task.run([ +@@ -499,7 +492,7 @@ module.exports = function (grunt) { + 'wiredep', + 'concurrent:server', + 'autoprefixer:server', +- 'connect:livereload', ++ 'browserSync:livereload', + 'watch' + ]); + }); +@@ -514,7 +507,7 @@ module.exports = function (grunt) { + 'wiredep', + 'concurrent:test', + 'autoprefixer', +- 'connect:test', ++ 'browserSync:test', + 'karma' + ]); + +diff --git a/templates/common/root/_package.json b/templates/common/root/_package.json +index 6a62991..f2cce83 100644 +--- a/templates/common/root/_package.json ++++ b/templates/common/root/_package.json +@@ -11,7 +11,6 @@ + "grunt-contrib-coffee": "^0.12.0",<% } %><% if (compass) { %> + "grunt-contrib-compass": "^1.0.0",<% } %> + "grunt-contrib-concat": "^0.5.0", +- "grunt-contrib-connect": "^0.9.0", + "grunt-contrib-copy": "^0.7.0", + "grunt-contrib-cssmin": "^0.12.0", + "grunt-contrib-htmlmin": "^0.4.0", +@@ -19,6 +18,7 @@ + "grunt-contrib-jshint": "^0.11.0", + "grunt-contrib-uglify": "^0.7.0", + "grunt-contrib-watch": "^0.6.1", ++ "grunt-browser-sync": "^2.0.0", + "grunt-filerev": "^2.1.2", + "grunt-google-cdn": "^0.4.3", + "grunt-newer": "^1.1.0", diff --git a/templates/common/root/_Gruntfile.js b/templates/common/root/_Gruntfile.js index 7786cd09d..67a4c5b89 100644 --- a/templates/common/root/_Gruntfile.js +++ b/templates/common/root/_Gruntfile.js @@ -55,10 +55,7 @@ module.exports = function (grunt) { },<% } else { %> js: { files: ['<%%= yeoman.app %>/scripts/{,*/}*.js'], - tasks: ['newer:jshint:all', 'newer:jscs:all'], - options: { - livereload: '<%%= connect.options.livereload %>' - } + tasks: ['newer:jshint:all', 'newer:jscs:all'] }, jsTest: { files: ['test/spec/{,*/}*.js'], @@ -76,9 +73,6 @@ module.exports = function (grunt) { files: ['Gruntfile.js'] }, livereload: { - options: { - livereload: '<%%= connect.options.livereload %>' - }, files: [ '<%%= yeoman.app %>/{,*/}*.html', '.tmp/styles/{,*/}*.css',<% if (coffee || typescript) { %> @@ -89,52 +83,51 @@ module.exports = function (grunt) { }, // The actual grunt server settings - connect: { - options: { - port: 9000, - // Change this to '0.0.0.0' to access the server from outside. - hostname: 'localhost', - livereload: 35729 - }, + browserSync: { livereload: { + bsFiles: { + src: [ + '<%%= yeoman.app %>/{,*/}*.html', + '.tmp/styles/{,*/}*.css', + '<%%= yeoman.app %>/scripts/{,*/}*.js', + '<%%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}' + ] + }, options: { - open: true, - middleware: function (connect) { - return [ - connect.static('.tmp'), - connect().use( - '/bower_components', - connect.static('./bower_components') - ), - connect().use( - '/app/styles', - connect.static('./app/styles') - ), - connect.static(appConfig.app) - ]; + watchTask: true, + server: { + baseDir: [appConfig.app, '.tmp'], + routes: { + '/bower_components': 'bower_components' + } } } }, - test: { + dist: { + bsFiles: { + src: '<%%= yeoman.dist %>/{,*/}*.html' + }, options: { - port: 9001, - middleware: function (connect) { - return [ - connect.static('.tmp'), - connect.static('test'), - connect().use( - '/bower_components', - connect.static('./bower_components') - ), - connect.static(appConfig.app) - ]; + server: { + baseDir: appConfig.dist } } }, - dist: { + test: { + bsFiles: { + src: 'test/spec/{,*/}*.js' + }, options: { - open: true, - base: '<%%= yeoman.dist %>' + watchTask: true, + port: 9001, + open: false, + logLevel: 'silent', + server: { + baseDir: ['test', '.tmp', appConfig.app], + routes: { + '/bower_components': 'bower_components' + } + } } } }, @@ -571,9 +564,9 @@ module.exports = function (grunt) { }); - grunt.registerTask('serve', 'Compile then start a connect web server', function (target) { + grunt.registerTask('serve', 'Compile then start a BrowserSync web server', function (target) { if (target === 'dist') { - return grunt.task.run(['build', 'connect:dist:keepalive']); + return grunt.task.run(['build', 'browserSync:dist']); } grunt.task.run([ @@ -582,7 +575,8 @@ module.exports = function (grunt) { 'tsd:refresh',<% } %> 'concurrent:server', 'postcss:server', - 'connect:livereload', + 'autoprefixer:server', + 'browserSync:livereload', 'watch' ]); }); @@ -598,7 +592,8 @@ module.exports = function (grunt) { 'tsd:refresh',<% } %> 'concurrent:test', 'postcss', - 'connect:test', + 'autoprefixer', + 'browserSync:test', 'karma' ]); diff --git a/templates/common/root/_package.json b/templates/common/root/_package.json index 8f08d4a24..af429d3d3 100644 --- a/templates/common/root/_package.json +++ b/templates/common/root/_package.json @@ -36,7 +36,6 @@ "grunt-contrib-coffee": "^0.12.0",<% } %><% if (compass) { %> "grunt-contrib-compass": "^1.0.0",<% } %> "grunt-contrib-concat": "^0.5.0", - "grunt-contrib-connect": "^0.9.0", "grunt-contrib-copy": "^0.7.0", "grunt-contrib-cssmin": "^0.12.0", "grunt-contrib-htmlmin": "^0.4.0", @@ -44,6 +43,7 @@ "grunt-contrib-jshint": "^0.11.0", "grunt-contrib-uglify": "^0.7.0", "grunt-contrib-watch": "^0.6.1", + "grunt-browser-sync": "^2.0.0", "grunt-filerev": "^2.1.2", "grunt-google-cdn": "^0.4.3",<% if (!coffee) { %> "grunt-jscs": "^1.8.0",<% } %>