Skip to content
This repository has been archived by the owner on Feb 5, 2025. It is now read-only.

Commit

Permalink
fix(build): 'grunt serve' results in 404
Browse files Browse the repository at this point in the history
  • Loading branch information
dabeng committed Jul 5, 2018
1 parent 34a6115 commit 5024c38
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
18 changes: 13 additions & 5 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module.exports = function (grunt) {
// '--sass' command line argument exists?
var sassBuild = grunt.option('sass');

// '--skipRebuild' command line argument exists?
var skipRebuild = grunt.option('skipRebuild');

// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

Expand Down Expand Up @@ -836,11 +839,16 @@ module.exports = function (grunt) {
]);
});

grunt.registerTask('serve', [
'connect:server',
'open',
'watch'
]);
grunt.registerTask('serve', function () {
if (!skipRebuild){
grunt.task.run('build');
}
grunt.task.run([
'connect:server',
'open',
'watch'
]);
});

grunt.registerTask('open', function () {
open('http://localhost:9000');
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ so you get the latest version of the dependencies specified in package.json.

### Live Reload Server

A local development server can be quickly fired up by using the Gruntjs server task:
A local development server can be quickly fired up by using the Gruntjs serve task:

```
npm start
Expand All @@ -150,7 +150,8 @@ npm start
or

```
grunt server
grunt serve # will build first by default
grunt serve --skipRebuild # flag would allow you to skip the rebuild to save some time
```

This local static asset server (i.e., [http://localhost:9000](http://localhost:9000)) has the advantage of having livereload integration. Thus, if you start the Gruntjs server, any changes you make to `.html` or `.less` files will be automatically reloaded into your browser and the changes reflected almost immediately. This has the obvious benefit of not having to refresh your browser and still be able to see the changes as you add or remove them from your development files. Additionally, any changes made to Jekyll source files (`tests/pages/`) will trigger a Jekyll build.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"patternfly": "grunt build-patternfly",
"rcue": "grunt build-rcue",
"jekyll": "ruby --version || echo \"Ruby required\"; bundler -v || gem install bundler; bundle check || bundle install; set -e",
"start": "grunt build serve",
"start": "grunt serve",
"start-patternfly": "grunt build-patternfly serve",
"start-rcue": "grunt build-rcue serve",
"grunt": "grunt",
Expand Down

0 comments on commit 5024c38

Please sign in to comment.