-
Notifications
You must be signed in to change notification settings - Fork 96
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
Upgraded to node-sass 2.0.1 #49
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
/.idea/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,62 @@ | ||
var path = require('path') | ||
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) | ||
SassCompiler.prototype.constructor = SassCompiler | ||
function SassCompiler (inputTrees, inputFile, outputFile, options) { | ||
if (!(this instanceof SassCompiler)) return new SassCompiler(inputTrees, inputFile, outputFile, options) | ||
if (!Array.isArray(inputTrees)) throw new Error('Expected array for first argument - did you mean [tree] instead of tree?') | ||
|
||
CachingWriter.call(this, inputTrees, options) | ||
|
||
this.inputFile = inputFile | ||
this.outputFile = outputFile | ||
options = options || {} | ||
this.sassOptions = { | ||
imagePath: options.imagePath, | ||
outputStyle: options.outputStyle, | ||
sourceComments: options.sourceComments, | ||
sourceMap: options.sourceMap, | ||
precision: options.precision | ||
} | ||
} | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
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); | ||
SassCompiler.prototype.constructor = SassCompiler; | ||
function SassCompiler(inputTrees, inputFile, outputFile, options) { | ||
if (!(this instanceof SassCompiler)) | ||
return new SassCompiler(inputTrees, inputFile, outputFile, options); | ||
|
||
SassCompiler.prototype.updateCache = function(includePaths, destDir) { | ||
var self = this | ||
if (!Array.isArray(inputTrees)) | ||
throw new Error('Expected array for first argument - did you mean [tree] instead of tree?'); | ||
|
||
return new Promise(function(resolve, reject) { | ||
var destFile = path.join(destDir, self.outputFile) | ||
mkdirp.sync(path.dirname(destFile)) | ||
CachingWriter.call(this, inputTrees, options); | ||
|
||
var sassOptions = { | ||
file: includePathSearcher.findFileSync(self.inputFile, includePaths), | ||
includePaths: includePaths, | ||
outFile: destFile, | ||
success: function() { | ||
resolve(this) | ||
}, | ||
error: function(err) { | ||
reject(err) | ||
} | ||
this.inputFile = inputFile; | ||
this.outputFile = outputFile; | ||
options = options || {}; | ||
this.sassOptions = { | ||
imagePath: options.imagePath, | ||
outputStyle: options.outputStyle, | ||
sourceComments: options.sourceComments, | ||
sourceMap: options.sourceMap, | ||
precision: options.precision | ||
} | ||
_.merge(sassOptions, self.sassOptions) | ||
sass.renderFile(sassOptions) | ||
}) | ||
} | ||
|
||
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 sassOptions = { | ||
file: includePathSearcher.findFileSync(self.inputFile, includePaths), | ||
includePaths: includePaths, | ||
outFile: destFile, | ||
success: function (res) { | ||
fs.writeFile(destFile, res.css, function (err) { | ||
if (err != null) | ||
reject(err); | ||
else | ||
resolve(this); | ||
}); | ||
}, | ||
error: function (err) { | ||
reject(err) | ||
} | ||
}; | ||
_.merge(sassOptions, self.sassOptions); | ||
sass.render(sassOptions); | ||
}) | ||
}; | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
{ | ||
"name": "broccoli-sass", | ||
"description": "Libsass-based Sass compiler for Broccoli", | ||
"version": "0.3.3", | ||
"author": "Jo Liss <joliss42@gmail.com>", | ||
"version": "0.3.4", | ||
"author": [ | ||
"Jo Liss <joliss42@gmail.com>", | ||
"Jaroslaw Zabiello <hipertracker@gmail.com>" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am unsure if you are considered the original author, rather just contributor. If you end up committing actively long-term I am sure @joliss would share this responsibility and authorship with you |
||
], | ||
"main": "index.js", | ||
"license": "MIT", | ||
"repository": { | ||
|
@@ -17,11 +20,11 @@ | |
"libsass" | ||
], | ||
"dependencies": { | ||
"broccoli-caching-writer": "^0.5.0", | ||
"broccoli-caching-writer": "^0.5.5", | ||
"include-path-searcher": "^0.1.0", | ||
"lodash": "~2.4.1", | ||
"mkdirp": "^0.3.5", | ||
"node-sass": "^1.1.4", | ||
"rsvp": "^3.0.6" | ||
"lodash": "^3.3.0", | ||
"mkdirp": "^0.5.0", | ||
"node-sass": "^2.0.1", | ||
"rsvp": "^3.0.17" | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
although this is pre-existing, we should require the exact part of lodash that we need. Otherwise this can be a spin up hit.