Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix template names when walkdir returns absolute paths. #71

Merged
merged 1 commit into from
Aug 6, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/cli/command.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CoffeeScript = require 'coffee-script'
CoffeeMaker = require './coffee-maker'
fs = require 'fs'
path = require 'path'
walkdir = require 'walkdir'

red = '\u001b[31m'
Expand Down Expand Up @@ -185,6 +186,10 @@ exports.run = ->

# Loop through all Haml files and compile them
for filename in walkdir.sync baseDir
# walkdir sometimes returns absolute paths
if filename.substring(0, 1) is '/'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filename = path.relative baseDir, filename if filename[..0] is '/'

Seems a bit more coffee-ish. Just a minor nitpick though.

filename = path.relative(baseDir, filename)

if filename.match /([^\.]+)(\.html)?\.haml[c]?$/

# Combine all files into a single output
Expand Down