tasks/joosy.coffee in joosy-1.2.0.alpha.29 vs tasks/joosy.coffee in joosy-1.2.0.alpha.30
- old
+ new
@@ -88,18 +88,26 @@
assets = grunt.joosy.assets.instance()
server.use path, Mincer.createServer(assets)
console.log "=> Serving assets from #{path}"
- serveHAML: (server, path='/', source='source/index.haml') ->
- server.use path, (req, res, next) ->
- if req.url == path
- console.log "Served #{path} (#{source})"
- res.end grunt.joosy.haml.compile(source)
- else
- next()
+ serveHAML: (server, map) ->
+ return unless map?
+ for _, entry of map
+ paths = entry.path
+ paths = [paths] unless Object.isArray(paths)
+
+ for path in paths
+ server.use path, (req, res, next) ->
+ if req.url == path
+ res.end grunt.joosy.haml.compile("source/"+entry.src)
+ console.log "Served #{path} (#{entry.src})"
+ else
+ next()
+ console.log "=> Serving #{entry.src} from #{paths.join(', ')}"
+
serveStatic: (server, compress=false) ->
Gzippo = require 'gzippo'
unless compress
server.use connect.static('public')
@@ -130,10 +138,10 @@
grunt.registerTask 'joosy:server', ->
@async()
grunt.joosy.server.start 4000, (server) ->
grunt.joosy.server.serveAssets server
- grunt.joosy.server.serveHAML server
+ grunt.joosy.server.serveHAML server, grunt.config.get('joosy.haml')
grunt.joosy.server.serveProxied server, grunt.config.get('joosy.server.proxy')
grunt.joosy.server.serveStatic server
grunt.registerTask 'joosy:server:production', ->
@async()
\ No newline at end of file