I’m learning how to propel use gruntjs. I found the server task but I can’t get the point.
Can i use the server task mapping concatenated/minified files to test my application (uses backbone.js) without moving or placing source files in web server root? Without apache for example.
If no, what’s the supposed use of server task?
The
servertask is used to start a static server with thebasepath set as the web root.Example: Serve
./web-rootashttp://localhost:8080/:It will function similar to an Apache server, serving up static files based on their path, but uses the http module via connect to set it up (source).
If you need it to serve more than just static files, then you’ll want to consider defining a custom
servertask:And custom server instance:
Concatenation and minification have their own dedicated tasks —
concatandmin— but could be used along with aservertask to accomplish all 3.Edit
If you want it to persist the server for a while (as well as grunt), you could define the task as asynchronous (with the server’s
'close'event):