Skip to content

Instantly share code, notes, and snippets.

@bartschuller
Created July 12, 2011 18:23
Show Gist options
  • Save bartschuller/1078610 to your computer and use it in GitHub Desktop.
Save bartschuller/1078610 to your computer and use it in GitHub Desktop.
Resolving imports in lesscss files for dependency tracking
import io.Source
import java.io.File
object Stuff {
val Import = """.*@import\s*"(.*?)".*""".r
def allLessFiles(initial: File): Set[File] =
Set(initial) ++ Source.fromFile(initial).getLines().flatMap[File](_ match {
case Import(file) => allLessFiles(new File(initial.getParentFile, file))
case _ => Set.empty
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment