Can't it also be .css? So how about something like:

    if (!filename.match(/\.(css|less)$/))
      filename += '.less';