Skip to content
This repository was archived by the owner on May 25, 2019. It is now read-only.

Commit 444e51c

Browse files
committed
feat(grunt): add connect tasks
1 parent 93e9eee commit 444e51c

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@ We have one task to serve them all !
106106
grunt serve
107107
```
108108

109-
It's equal to run separately:
109+
It's equal to run separately:
110+
111+
* `grunt connect:server` : giving you a development server at [http://127.0.0.1:8000/](http://127.0.0.1:8000/).
110112

111113
* `grunt karma:server` : giving you a Karma server to run tests (at [http://localhost:9876/](http://localhost:9876/) by default). You can force a test on this server with `grunt karma:unit:run`.
112114

113-
* `grunt watch` : will automatically test your code and build your demo. You can demo generation with `grunt build-doc`.
115+
* `grunt watch` : will automatically test your code and build your demo. You can demo generation with `grunt build:gh-pages`.

gruntFile.js

+17-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = function (grunt) {
66

77
// Default task.
88
grunt.registerTask('default', ['jshint', 'karma:unit']);
9-
grunt.registerTask('serve', ['karma:continuous', 'dist', 'watch']);
9+
grunt.registerTask('serve', ['karma:continuous', 'dist', 'build:gh-pages', 'connect:continuous', 'watch']);
1010
grunt.registerTask('dist', ['ngmin', 'uglify']);
1111

1212
// HACK TO ACCESS TO THE COMPONENT-PUBLISHER
@@ -67,15 +67,19 @@ module.exports = function (grunt) {
6767
watch: {
6868
src: {
6969
files: ['src/*'],
70-
tasks: ['jshint:src', 'karma:unit:run', 'dist']
70+
tasks: ['jshint:src', 'karma:unit:run', 'dist', 'build:gh-pages']
7171
},
7272
test: {
7373
files: ['test/*.js'],
7474
tasks: ['jshint:test', 'karma:unit:run']
7575
},
7676
demo: {
7777
files: ['demo/*', 'publish.js'],
78-
tasks: ['jshint']
78+
tasks: ['jshint', 'build:gh-pages']
79+
},
80+
livereload: {
81+
files: ['out/built/gh-pages/**/*'],
82+
options: { livereload: true }
7983
}
8084
},
8185

@@ -85,6 +89,16 @@ module.exports = function (grunt) {
8589
continuous: {configFile: 'test/karma.conf.js', background: true }
8690
},
8791

92+
connect: {
93+
options: {
94+
base : 'out/built/gh-pages',
95+
open: true,
96+
livereload: true
97+
},
98+
server: { options: { keepalive: true } },
99+
continuous: { options: { keepalive: false } }
100+
},
101+
88102
jshint: {
89103
src: {
90104
files:{ src : ['src/*.js', 'demo/**/*.js'] },

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"devDependencies": {
1111
"angular-ui-publisher": "1.x",
1212
"grunt": "0.4.x",
13+
"grunt-contrib-connect": "0.5.x",
1314
"grunt-contrib-copy": "0.5.x",
1415
"grunt-contrib-jshint": "0.8.x",
1516
"grunt-contrib-uglify": "0.2.x",

0 commit comments

Comments
 (0)