Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slowness #8

Closed
acjay opened this issue Jul 25, 2014 · 7 comments
Closed

Slowness #8

acjay opened this issue Jul 25, 2014 · 7 comments

Comments

@acjay
Copy link

acjay commented Jul 25, 2014

A project I'm on just recently converted to sbt-sass after relying on a custom-written task for a while. sbt-sass is vastly underperforming. It takes about a minute to compile our 16 sass files, when it used to be a few seconds. We use the Susy grid framework, which is included by most of the files we compile. Any ideas for how we can speed sbt-sass up?

Here is the task we used to use, for reference:


val sassTask = taskKey[Seq[File]]("Compiles Sass files")

val sassOutputDir = settingKey[File]("Output directory for Sass generated files")

val sassLibDirs = settingKey[Seq[File]]("Directories for Sass library includes")

sassOutputDir := target.value / "web" / "sass" / "main"

sassLibDirs := Seq(
  target.value / "web" / "web-modules" / "main" / "webjars" / "lib" / "susy" / "sass"
)

resourceDirectories in Assets += sassOutputDir.value

sassTask := {
  val x = (WebKeys.nodeModules in Assets).value // to depend on Webjars being installed before building Sass
  val sourceDir = (sourceDirectory in Assets).value
  val outputDir = sassOutputDir.value
  val sourceFiles = (sourceDir ** "*.scss").get
  val includes = sassLibDirs.value map (_.toString) flatMap { Seq("-I", _) }
  (Seq("sass", "--update") ++ includes ++ Seq(s"$sourceDir:$outputDir")).!
  (outputDir ** "*.css").get
}

sourceGenerators in Assets <+= sassTask
@acjay
Copy link
Author

acjay commented Jul 31, 2014

@ShaggyYeti Please let me know if you have any advice. We will need to switch back to my ad hoc SBT task or another Sass solution if there's no info on what's causing the slowness and no way to address it.

If it's any help, every time I change one .scss file, it says it's compiling all 16 files, so it seems like it may not be tracking unchanged files correctly.

@ShaggyYeti
Copy link
Owner

Hello. I was on summer holiday. :)

So, in my project plugin compiles 33 files 1-2 sec.

so it seems like it may not be tracking unchanged files correctly.

I'll check code today.

@ShaggyYeti
Copy link
Owner

Seems that problem has fixed. Check it please with new version 0.1.4

@acjay
Copy link
Author

acjay commented Aug 1, 2014

Lovely, thanks!

@ShaggyYeti
Copy link
Owner

Does it work properly?

@acjay
Copy link
Author

acjay commented Aug 1, 2014

Indeed it does! Changes to individual SCSS files only take a second or so to recompile. It's great, thanks!

@ShaggyYeti
Copy link
Owner

Great! You're welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants