Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Commit

Permalink
wip browserSync support in grunt
Browse files Browse the repository at this point in the history
  • Loading branch information
robdodson committed Feb 7, 2015
1 parent 6458a4d commit 974e743
Showing 1 changed file with 24 additions and 41 deletions.
65 changes: 24 additions & 41 deletions app/templates/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,53 +113,37 @@ module.exports = function (grunt) {
}]
}
},
connect: {
browserSync: {
options: {
notify: false,
port: 9000,
// change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
open: true
},
livereload: {
app: {
options: {
middleware: function (connect) {
return [
lrSnippet,
connect.static('.tmp'),
connect.static(yeomanConfig.app),
connect().use('/bower_components', connect.static('./bower_components'))
];
watchTask: true,
server: {
baseDir: ['.tmp', '<%%= yeoman.app %>'],
routes: {
'/bower_components': 'bower_components'
}
}
}
},
test: {
options: {
open: {
target: 'http://localhost:<%%= connect.options.port %>/test'
},
middleware: function (connect) {
return [
connect.static('.tmp'),
connect.static('test'),
connect.static(yeomanConfig.app),
connect().use('/bower_components', connect.static('./bower_components'))
];
},
keepalive: true
}
},
src: [
'.tmp/**/*.{css,html,js}',
'<%%= yeoman.app %>/**/*.{css,html,js}'
]
},
dist: {
options: {
middleware: function (connect) {
return [
connect.static(yeomanConfig.dist)
];
server: {
baseDir: 'dist'
}
}
}
},
open: {
server: {
path: 'http://localhost:<%%= connect.options.port %>'
},
src: [
'<%%= yeoman.dist %>/**/*.{css,html,js}',
'!<%%= yeoman.dist %>/bower_components/**/*'
]
}
},
clean: {
Expand Down Expand Up @@ -336,16 +320,15 @@ module.exports = function (grunt) {

grunt.registerTask('serve', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'open', 'connect:dist:keepalive']);
return grunt.task.run(['build', 'browserSync:dist']);
}

grunt.task.run([
'clean:server',<% if (includeSass) { %>
'sass:server',<% } %>
'copy:styles',
'autoprefixer:server',
'connect:livereload',
'open',
'browserSync:app',
'watch'
]);
});
Expand Down

0 comments on commit 974e743

Please sign in to comment.