Skip to content

Commit

Permalink
Upgrade to node-sass 2.0.1, and remove defective source map support
Browse files Browse the repository at this point in the history
  • Loading branch information
joliss committed Feb 26, 2015
1 parent ca3b8d9 commit 6e600fe
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# master

* Upgrade to node-sass 2.0.1
* Remove defective source map support; we may bring it back later

# 0.3.3

* Upgrade to node-sass ^1.1.4
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var outputTree = compileSass(inputTrees, inputFile, outputFile, options);
* **`outputFile`**: Relative path of the output CSS file.

* **`options`**: A hash of options for libsass. Supported options are
`imagePath`, `outputStyle`, `precision`, `sourceComments`, and `sourceMap`.
`imagePath`, `outputStyle`, `precision`, and `sourceComments`.

### Example

Expand Down
31 changes: 12 additions & 19 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
var path = require('path')
var fs = require('fs')
var mkdirp = require('mkdirp')
var includePathSearcher = require('include-path-searcher')
var CachingWriter = require('broccoli-caching-writer')
var sass = require('node-sass')
var _ = require('lodash')
var Promise = require('rsvp').Promise

module.exports = SassCompiler
SassCompiler.prototype = Object.create(CachingWriter.prototype)
Expand All @@ -22,7 +22,6 @@ function SassCompiler (inputTrees, inputFile, outputFile, options) {
imagePath: options.imagePath,
outputStyle: options.outputStyle,
sourceComments: options.sourceComments,
sourceMap: options.sourceMap,
precision: options.precision
}
}
Expand All @@ -31,22 +30,16 @@ function SassCompiler (inputTrees, inputFile, outputFile, options) {
SassCompiler.prototype.updateCache = function(includePaths, destDir) {
var self = this

return new Promise(function(resolve, reject) {
var destFile = path.join(destDir, self.outputFile)
mkdirp.sync(path.dirname(destFile))
var destFile = path.join(destDir, self.outputFile)
mkdirp.sync(path.dirname(destFile))

var sassOptions = {
file: includePathSearcher.findFileSync(self.inputFile, includePaths),
includePaths: includePaths,
outFile: destFile,
success: function() {
resolve(this)
},
error: function(err) {
reject(err)
}
}
_.merge(sassOptions, self.sassOptions)
sass.renderFile(sassOptions)
})
var sassOptions = {
file: includePathSearcher.findFileSync(self.inputFile, includePaths),
includePaths: includePaths,
}
_.merge(sassOptions, self.sassOptions)
result = sass.renderSync(sassOptions)
// libsass emits `@charset "UTF-8";`, so we must encode with UTF-8; see also
// https://github.com/sass/node-sass/issues/711
fs.writeFileSync(destFile, result.css, { encoding: 'utf8' })
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"include-path-searcher": "^0.1.0",
"lodash": "~2.4.1",
"mkdirp": "^0.3.5",
"node-sass": "^1.1.4",
"node-sass": "^2.0.1",
"rsvp": "^3.0.6"
}
}

0 comments on commit 6e600fe

Please sign in to comment.