Skip to content
This repository was archived by the owner on Nov 8, 2017. It is now read-only.

Commit db81ca5

Browse files
author
Artur Sapek
committed
Make local dev server a cake task
1 parent 15e0a3d commit db81ca5

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

Cakefile

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Cakefile for Mondrian
22
# Builds the app and the test files
33

4+
connect = require('connect')
5+
http = require('http')
6+
47
fs = require 'fs'
58
{exec} = require 'child_process'
69
lessc = require 'less'
@@ -54,9 +57,11 @@ validateBuildFiles = (paths) ->
5457
log = (status, msg) ->
5558
switch status
5659
when "ok"
57-
console.log "[OK] ".green + msg
60+
console.log "[OK] ".green + msg
5861
when "error"
5962
console.log "[ERROR] ".red + msg
63+
when "info"
64+
console.log "[INFO] ".magenta + msg
6065

6166
compileCSS = (pairs) ->
6267
pairs.forEach (config) ->
@@ -184,6 +189,17 @@ task 'build', 'Build project', ->
184189
exec "echo #{compileTime} > .compiletime"
185190

186191

192+
task 'server', 'Run local server', ->
193+
directory = [__dirname, "build"].join('/')
194+
195+
connect()
196+
.use(connect.static(directory))
197+
.use(connect.logger('dev'))
198+
.listen 3000
199+
200+
log "info", "Listening on port 3000."
201+
202+
187203
task 'lengths', 'Print source file lengths', ->
188204
filePaths (paths) ->
189205
fileLengths paths

server.coffee

-11
This file was deleted.

0 commit comments

Comments
 (0)