tasks/joosy.coffee in joosy-1.2.0.alpha.31 vs tasks/joosy.coffee in joosy-1.2.0.alpha.32
- old
+ new
@@ -50,16 +50,18 @@
grunt.file.write entry.dest, asset.toString()
callbacks.compiled? asset, entry.dest
callbacks.success?() if deepness == 0
haml:
- compile: (file, environment='development') ->
+ compile: (file, partials='./', environment='development') ->
HAMLC = require 'haml-coffee'
HAMLC.compile(grunt.file.read file)(
environment: environment
config: grunt.config.get('joosy.config') || {}
+ partial: (location) ->
+ grunt.joosy.haml.compile(partials+'/'+location, environment)
)
server:
start: (port, setup) ->
server = connect()
@@ -97,12 +99,12 @@
paths = entry.path
paths = [paths] unless Object.isArray(paths)
for path in paths
server.use path, (req, res, next) ->
- if req.url == '/'
- res.end grunt.joosy.haml.compile("source/"+entry.src)
+ if req.originalUrl == path
+ res.end grunt.joosy.haml.compile("source/"+entry.src, entry.partials)
console.log "Served #{path} (#{entry.src})"
else
next()
console.log "=> Serving #{entry.src} from #{paths.join(', ')}"
@@ -161,7 +163,7 @@
compiled: (asset, dest) -> grunt.log.ok "Compiled #{dest}"
success: complete
grunt.registerTask 'joosy:haml', ->
for _, entry of grunt.joosy.helpers.list(@, 'joosy.haml', @args[0])
- grunt.file.write entry.dest, grunt.joosy.haml.compile("source/#{entry.src}", 'production')
+ grunt.file.write entry.dest, grunt.joosy.haml.compile("source/#{entry.src}", entry.partials, 'production')
grunt.log.ok "Compiled #{entry.dest}"
\ No newline at end of file