<commit_before>/*
 * Copyright 2015 <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.irundaia.sbt.sass

import com.typesafe.sbt.web.Import.WebKeys._
import com.typesafe.sbt.web.SbtWeb.autoImport._
import com.typesafe.sbt.web.incremental.{OpInputHash, OpInputHasher, OpResult, OpFailure}
import com.typesafe.sbt.web.{LineBasedProblem, CompileProblems, SbtWeb, incremental}
import org.irundaia.sbt.sass.compiler.{SassCompilerException, SassCompiler, CompilerSettings}
import sbt.Keys._
import sbt._
import xsbti.{Severity, Problem}

import scala.language.implicitConversions
import scala.util.{Try, Success, Failure}

object SassKeys {
  val sassify = TaskKey[Seq[File]]("sassify", "Generate css files from scss and sass files.")

  val cssStyle = SettingKey[CssStyle]("cssStyle", "The style of the to-be-output CSS files.")
  val generateSourceMaps =
    SettingKey[Boolean]("generateSourceMaps", "Whether or not source map files should be generated.")
  val embedSources =
    SettingKey[Boolean]("embedSources", "Whether or not the source files should be embedded in the source map")
  val syntaxDetection =
    SettingKey[SyntaxDetection]("syntaxDetection", "How to determine whether the sass/scss syntax is used")
}

object SbtSassify extends AutoPlugin {
  override def requires: Plugins = SbtWeb
  override def trigger: PluginTrigger = AllRequirements
  import SassKeys._

  override lazy val buildSettings = Seq(
    cssStyle := Minified,
    generateSourceMaps := true,
    embedSources := true,
    syntaxDetection := Auto
  )

  val baseSbtSassifySettings = Seq(
    excludeFilter in sassify := HiddenFileFilter || "_*",
    includeFilter in sassify := "*.sass" || "*.scss",

    managedResourceDirectories += (resourceManaged in sassify in Assets).value,
    resourceManaged in sassify in Assets := webTarget.value / "sass" / "main",
    resourceGenerators in Assets <+= sassify in Assets,

    sassify in Assets := Def.task {
      val sourceDir = (sourceDirectory in Assets).value
      val targetDir = (resourceManaged in sassify in Assets).value
      val webJarsDir = (webJarsDirectory in Assets).value
      println(webJarsDir)
      val sources = (sourceDir ** ((includeFilter in sassify in Assets).value -- (excludeFilter in sassify in Assets).value)).get
      lazy val compilerSettings =<commit_msg>Remove println<commit_after>/*
 * Copyright 2015 <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.irundaia.sbt.sass

import com.typesafe.sbt.web.Import.WebKeys._
import com.typesafe.sbt.web.SbtWeb.autoImport._
import com.typesafe.sbt.web.incremental.{OpInputHash, OpInputHasher, OpResult, OpFailure}
import com.typesafe.sbt.web.{LineBasedProblem, CompileProblems, SbtWeb, incremental}
import org.irundaia.sbt.sass.compiler.{SassCompilerException, SassCompiler, CompilerSettings}
import sbt.Keys._
import sbt._
import xsbti.{Severity, Problem}

import scala.language.implicitConversions
import scala.util.{Try, Success, Failure}

object SassKeys {
  val sassify = TaskKey[Seq[File]]("sassify", "Generate css files from scss and sass files.")

  val cssStyle = SettingKey[CssStyle]("cssStyle", "The style of the to-be-output CSS files.")
  val generateSourceMaps =
    SettingKey[Boolean]("generateSourceMaps", "Whether or not source map files should be generated.")
  val embedSources =
    SettingKey[Boolean]("embedSources", "Whether or not the source files should be embedded in the source map")
  val syntaxDetection =
    SettingKey[SyntaxDetection]("syntaxDetection", "How to determine whether the sass/scss syntax is used")
}

object SbtSassify extends AutoPlugin {
  override def requires: Plugins = SbtWeb
  override def trigger: PluginTrigger = AllRequirements
  import SassKeys._

  override lazy val buildSettings = Seq(
    cssStyle := Minified,
    generateSourceMaps := true,
    embedSources := true,
    syntaxDetection := Auto
  )

  val baseSbtSassifySettings = Seq(
    excludeFilter in sassify := HiddenFileFilter || "_*",
    includeFilter in sassify := "*.sass" || "*.scss",

    managedResourceDirectories += (resourceManaged in sassify in Assets).value,
    resourceManaged in sassify in Assets := webTarget.value / "sass" / "main",
    resourceGenerators in Assets <+= sassify in Assets,

    sassify in Assets := Def.task {
      val sourceDir = (sourceDirectory in Assets).value
      val targetDir = (resourceManaged in sassify in Assets).value
      val webJarsDir = (webJarsDirectory in Assets).value

      val sources = (sourceDir ** ((includeFilter in sassify in Assets).value -- (excludeFilter in sassify in Assets).value)).get
      lazy val compilerSettings =
{'fraction_non_alphanumeric': 0.09190140845070423, 'fraction_numerical': 0.0028169014084507044, 'mean_word_length': 4.309345794392524, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4881089', 'n_tokens_mistral': 1698, 'n_tokens_neox': 1647, 'n_words': 554}