Skip to content

Commit

Permalink
fixes for sass
Browse files Browse the repository at this point in the history
  • Loading branch information
davydotcom committed Jul 22, 2016
1 parent 4002547 commit f463666
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ class ClosureCompilerProcessor {
outputWriter.close();
output = "//# sourceMappingURL=${baseFileName + '.js.map'}\n" + output
}
if(!output) {
return inputText
}
return output
}

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

subprojects {
version = '2.9.5'
version = '2.9.6'
}

apply plugin: 'groovy'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ import asset.pipeline.AssetCompiler
import asset.pipeline.processors.CssProcessor
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import groovy.util.logging.Commons


@Commons
class AssetPipelineLessSource extends LessSource {
def sourceFile
String contents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import asset.pipeline.AbstractProcessor
import asset.pipeline.AssetCompiler
import asset.pipeline.AssetFile
import groovy.util.logging.Commons
import groovy.util.logging.Log4j
import asset.pipeline.processors.CssProcessor
import org.mozilla.javascript.Context
import org.mozilla.javascript.JavaScriptException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class SassAssetFileImporter implements Importer {
if (baseFile && importedAssetFile) {
CacheManager.addCacheDependency(baseFile.name, importedAssetFile)
def results = Collections.singletonList(
new Import(importedAssetFile.name, importedAssetFile.path, importedAssetFile.inputStream.text)
new Import(importedAssetFile.name, importedAssetFile.path, importedAssetFile.inputStream.getText('UTF-8'))
)
return results
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import asset.pipeline.AbstractProcessor
import asset.pipeline.AssetCompiler
import asset.pipeline.AssetFile
import asset.pipeline.AssetPipelineConfigHolder
import groovy.util.logging.Log4j
import groovy.util.logging.Commons
import io.bit3.jsass.Compiler
import io.bit3.jsass.Options
import io.bit3.jsass.OutputStyle

@Log4j
@Commons
class SassProcessor extends AbstractProcessor {
final Compiler compiler = new Compiler();
final Options options = new Options();
Expand All @@ -45,7 +45,12 @@ class SassProcessor extends AbstractProcessor {
String process(String input, AssetFile assetFile) {
options.getImporters().add(new SassAssetFileImporter(assetFile))

log.info "Compiling $assetFile.name"
log.debug "Compiling $assetFile.name"
if(assetFile.name.endsWith('.sass')) {
options.setIsIndentedSyntaxSrc(true);
} else {
options.setIsIndentedSyntaxSrc(false);
}
def output = compiler.compileString(input, assetFile.path.toURI(), null, options)
return output.css
}
Expand Down

0 comments on commit f463666

Please sign in to comment.