Skip to content

Commit

Permalink
feat(docs): add grunt task to build and serve documentation
Browse files Browse the repository at this point in the history
Closes mozilla#43.
  • Loading branch information
Glavin001 committed Apr 5, 2015
1 parent 35cb45b commit e483739
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist
.tmp
.sass-cache
bower_components
docs
22 changes: 21 additions & 1 deletion Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = (grunt) ->
appConfig =
app: require("./bower.json").appPath or "app"
dist: "dist"

docs: "docs"

# Define the configuration for all the tasks
grunt.initConfig
Expand Down Expand Up @@ -105,6 +105,11 @@ module.exports = (grunt) ->
open: true
base: "<%= yeoman.dist %>"

docs:
options:
open: true
base: "<%= yeoman.docs %>"


# Make sure code styles are up to par and there are no obvious mistakes
jshint:
Expand All @@ -130,6 +135,8 @@ module.exports = (grunt) ->

server: ".tmp"

docs: "<%= yeoman.docs %>"


# Add vendor prefixed styles
autoprefixer:
Expand Down Expand Up @@ -181,6 +188,8 @@ module.exports = (grunt) ->
ext: ".js"
]

ngdocs:
all: ['.tmp/scripts/**/*.js']

# Compiles Sass to CSS and generates necessary files if requested
compass:
Expand Down Expand Up @@ -400,6 +409,12 @@ module.exports = (grunt) ->
"build"
"connect:dist:keepalive"
])
else if target is "docs"
return grunt.task.run([
"docs"
"connect:docs:keepalive"
])

grunt.task.run [
"clean:server"
"wiredep"
Expand Down Expand Up @@ -438,6 +453,11 @@ module.exports = (grunt) ->
"usemin"
"htmlmin"
]
grunt.registerTask "docs", [
"clean:docs"
"coffee:dist"
"ngdocs"
]
grunt.registerTask "default", [
"newer:jshint"
"test"
Expand Down
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Please see our [Contributing Guidelines](CONTRIBUTING.md)

You may need to prefix commands with `sudo`

- [Node.js](http://nodejs.org/)
- [Node.js](http://nodejs.org/)
- [Bower](http://bower.io/) `npm install -g bower`
- [Grunt](http://gruntjs.com/) `npm install -g grunt-cli`
- [Yeoman](http://yeoman.io/) `npm install -g yo`
Expand All @@ -70,8 +70,21 @@ bower install
Once you have the application and dependencies installed you can start building the app.

```bash
grunt build # builds the application to /dist
grunt serve # previews the app on a local server
# Previews the app on a local server
grunt serve

# Builds the application to dist/
grunt build
```

#### Documentation

```bash
# Build docs to docs/
grunt docs

# Build docs and serve docs/ for web browser
grunt serve:docs
```

#### Developing
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.0.0",
"dependencies": {},
"devDependencies": {
"coffee-script": "^1.7.1",
"grunt": "^0.4.5",
"grunt-autoprefixer": "^0.7.3",
"grunt-concurrent": "^0.5.0",
Expand All @@ -18,23 +19,23 @@
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-uglify": "^0.4.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-conventional-changelog": "^1.1.0",
"grunt-filerev": "^0.2.1",
"grunt-google-cdn": "^0.4.0",
"grunt-karma": "^0.8.3",
"grunt-newer": "^0.7.0",
"grunt-ngdocs": "^0.2.7",
"grunt-ngmin": "^0.0.3",
"grunt-svgmin": "^0.4.0",
"grunt-usemin": "^2.1.1",
"grunt-wiredep": "^1.9.0",
"jshint-stylish": "^0.2.0",
"load-grunt-tasks": "^0.4.0",
"time-grunt": "^0.3.1",
"karma-jasmine": "^0.1.5",
"coffee-script": "^1.7.1",
"grunt-karma": "^0.8.3",
"karma-phantomjs-launcher": "^0.1.4",
"karma": "^0.12.21",
"karma-coffee-preprocessor": "^0.2.1",
"grunt-conventional-changelog": "^1.1.0"
"karma-jasmine": "^0.1.5",
"karma-phantomjs-launcher": "^0.1.4",
"load-grunt-tasks": "^0.4.0",
"time-grunt": "^0.3.1"
},
"engines": {
"node": ">=0.10.0"
Expand Down

0 comments on commit e483739

Please sign in to comment.