Created
July 12, 2011 18:23
-
-
Save bartschuller/1078610 to your computer and use it in GitHub Desktop.
Resolving imports in lesscss files for dependency tracking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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