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

Commit

Permalink
Fix handling of Gists that don't have the new "frontmatter"-style com…
Browse files Browse the repository at this point in the history
…ments
  • Loading branch information
jedfoster committed Mar 22, 2013
1 parent a13d41d commit 850ecd4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sassmeister.rb
Expand Up @@ -113,16 +113,18 @@ def sass_convert(from_syntax, to_syntax, sass)

def unpack_dependencies(sass)
frontmatter = sass.slice(/^\/\/ ---\n(?:\/\/ .+\n)*\/\/ ---\n/)

return '' if frontmatter.nil?

frontmatter = frontmatter.to_s.gsub(/(\/\/ |---|\(.+$)/, '').strip.split(/\n/)
if frontmatter.nil?
frontmatter = sass.split(/(^\/\/ | v\d)/)
else
frontmatter = frontmatter.to_s.gsub(/(\/\/ |---|\(.+$)/, '').strip.split(/\n/)
end

frontmatter.delete_if do |x|
! @plugins.key?(x.to_s.strip)
end

frontmatter[0].strip
frontmatter[0].strip unless frontmatter.empty?
end

def pack_dependencies(params)
Expand Down

0 comments on commit 850ecd4

Please sign in to comment.