s3z s3z - 2 years ago 123
AngularJS Question

How to run grunt server in dist directory instead of app directory?


grunt build
ing my AngularJS app to my
directory, I would like to test it out with
grunt server
. Problem is that
grunt server
just serves up all the code in my
directory. Additionally, keep in mind that I created my app with
yo angular

Here is the server task code in my Gruntfile.js

grunt.registerTask('server', [

Is there a way to make
grunt server
only serve up the built code in my

Answer Source

Whether or not you could do it isn't important. What is important is that you should not use grunt server for this. The server task in grunt as you can see does many things that you don't need in a dist folder, as well as the fact that they will all be hard coded for your app folder.

If you just want to try out the result of the dist folder, what you should do is just cd into the dist directory and then start a simple HTTP server like the one that comes with python.

python -m SimpleHTTPServer

That should start a small server for you to try the dist directory out.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download