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

Commit cee6808

Browse files
committed
feat(grunt): add serve task
1 parent e508d51 commit cee6808

File tree

2 files changed

+22
-41
lines changed

2 files changed

+22
-41
lines changed

README.md

+6-35
Original file line numberDiff line numberDiff line change
@@ -98,45 +98,16 @@ grunt
9898
The karma task will try to open Firefox and Chrome as browser in which to run the tests. Make sure this is available or change the configuration in `test\karma.conf.js`
9999

100100

101-
### Watch
101+
### Grunt Serve
102102

103-
You can watch files change for your tests with
103+
We have one task to serve them all !
104104

105105
```sh
106-
grunt watch
106+
grunt serve
107107
```
108108

109-
Make sure to have a Karma server available with it.
109+
It's equal to run separately:
110110

111+
* `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`.
111112

112-
```sh
113-
grunt server
114-
```
115-
116-
(you can force a test on this server with `grunt karma:unit:run`)
117-
118-
119-
### Local Doc
120-
121-
The documentation is generated by bower and grunt. To build it run :
122-
123-
```sh
124-
grunt build-doc
125-
```
126-
127-
And then, launch a built-in web server on the angular-ui-docs bower module
128-
129-
```sh
130-
cd bower_components/angular-ui-docs/
131-
php -S localhost:8000
132-
or
133-
python -m SimpleHTTPServer
134-
```
135-
136-
Then check your [http://localhost:8000/](http://localhost:8000/)
137-
138-
**Tips for fast development** : Inline everything
139-
140-
```sh
141-
grunt build-doc && cd bower_components/angular-ui-docs/ && php -S localhost:8000 && cd ../..
142-
```
113+
* `grunt watch` : will automatically test your code and build your demo. You can demo generation with `grunt build-doc`.

gruntFile.js

+16-6
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ module.exports = function (grunt) {
44

55
// Default task.
66
grunt.registerTask('default', ['jshint', 'karma:unit']);
7-
grunt.registerTask('build-doc', ['uglify', 'copy']);
8-
grunt.registerTask('server', ['karma:start']);
7+
grunt.registerTask('serve', ['karma:continuous', 'dist', 'watch']);
98
grunt.registerTask('dist', ['ngmin', 'uglify']);
109

1110
// HACK TO ACCESS TO THE COMPONENT-PUBLISHER
@@ -62,15 +61,26 @@ module.exports = function (grunt) {
6261
]
6362
}
6463
},
64+
6565
watch: {
66-
karma: {
67-
files: ['ui-map.js', 'test/*.js'],
68-
tasks: ['karma:unit:run'] //NOTE the :run flag
66+
src: {
67+
files: ['src/*'],
68+
tasks: ['jshint:src', 'karma:unit:run', 'dist']
69+
},
70+
test: {
71+
files: ['test/*.js'],
72+
tasks: ['jshint:test', 'karma:unit:run']
73+
},
74+
demo: {
75+
files: ['demo/*', 'publish.js'],
76+
tasks: ['jshint']
6977
}
7078
},
79+
7180
karma: {
7281
unit: testConfig('test/karma.conf.js'),
73-
start: {configFile: 'test/karma.conf.js'}
82+
server: {configFile: 'test/karma.conf.js'},
83+
continuous: {configFile: 'test/karma.conf.js', background: true }
7484
},
7585

7686
jshint: {

0 commit comments

Comments
 (0)