Created
December 14, 2012 15:20
-
-
Save guillaumebort/4286209 to your computer and use it in GitHub Desktop.
Dynamically extracting SASS
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
val main = play.Project(appName, appVersion, appDependencies).settings( | |
resourceGenerators in Compile <+= (target, resourceManaged in Compile, cacheDirectory, streams) map { (target, resources, cache, streams) => | |
val logger = streams.log | |
val sassWorkingDir = target / "sass-blabla" | |
if(!sassWorkingDir.exists) { | |
val maybeSass = this.getClass.getClassLoader.getParent.asInstanceOf[java.net.URLClassLoader].getURLs.map(_.getFile).map(file).find { file => | |
logger.info(file.getAbsolutePath) | |
// check if it is the file we are looking for | |
false | |
} | |
maybeSass.map { zipFile => | |
IO.unzip(zipFile, sassWorkingDir) | |
}.orElse { | |
sys.error("OOPS. missing SASS?") | |
} | |
} | |
// Here `sassWorkingDir` references a directory containing the whole SASS Stuff, so you can work with it and process resources as usual. | |
// ... | |
// The dynamically generated ressources (CSS) here as expected | |
Seq.empty[File] | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment