From 314ce5c1594e541a55e5c5009fb0733c45226567 Mon Sep 17 00:00:00 2001 From: David Manning Date: Thu, 12 Feb 2015 13:49:11 -0800 Subject: [PATCH] Updated node-sass dependency --- CHANGELOG.md | 5 +++++ README.md | 7 ------- index.js | 20 ++++++++++++-------- package.json | 4 ++-- test/test.js | 17 +++++++++-------- 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 759a1c6..b3f5a35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +### 1.3.3 + +* updated to node-sass 2.0 (final) +* should now work with node 0.12 and io.js + ### 1.3.2 * fixed errLogToConsole diff --git a/README.md b/README.md index 583a2f6..74a8a2a 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,5 @@ [![Build Status](https://travis-ci.org/dlmanning/gulp-sass.svg?branch=master)](https://travis-ci.org/dlmanning/gulp-sass) - -#Attention: Read this before posting an issue - -At the moment gulp-sass will not work with node 0.12 or io.js. gulp-sass is just a wrapper around node-sass, which implements node bindings to libsass. The maintainers of node-sass are doing their best to finish version 2.0, which will include support for node 0.12 and io.js. In the meantime, there is nothing I can do to make gulp-sass work on on anything other that node 0.10.xx. If you need to run gulp-sass, don't upgrade node until node-sass 2.0 is finalized. - -Thanks - gulp-sass ========= diff --git a/index.js b/index.js index 8ff91fd..1996518 100644 --- a/index.js +++ b/index.js @@ -39,21 +39,25 @@ module.exports = function (options) { opts.success = function (obj) { if (typeof opts.onSuccess === 'function') opts.onSuccess(obj); - if (obj.map && obj.map.length || obj.map.version) { + if (obj.map && typeof obj.map === 'string') { // hack to remove the already added sourceMappingURL from libsass obj.css = obj.css.replace(/\/\*#\s*sourceMappingURL\=.*\*\//, ''); // libsass gives us sources' paths relative to file; // gulp-sourcemaps needs sources' paths relative to file.base; // so alter the sources' paths to please gulp-sourcemaps. - obj.map = obj.map.version ? obj.map : JSON.parse(obj.map); - obj.map.sources = obj.map.sources.map(function(source) { - var abs = path.resolve(path.dirname(file.path), source); - return path.relative(file.base, abs); - }); - obj.map = JSON.stringify(obj.map); + obj.map = JSON.parse(obj.map); + + if (obj.map.sources) { + obj.map.sources = obj.map.sources.map(function(source) { + var abs = path.resolve(path.dirname(file.path), source); + return path.relative(file.base, abs); + }); + + obj.map = JSON.stringify(obj.map); + applySourceMap(file, obj.map); + } - applySourceMap(file, obj.map); } handleOutput(obj, file, cb); diff --git a/package.json b/package.json index eab50d9..c80e7ef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gulp-sass", - "version": "1.3.2", + "version": "1.3.3", "description": "Gulp plugin for sass", "main": "index.js", "scripts": { @@ -24,7 +24,7 @@ "clone": "~0.1.18", "gulp-util": "^3.0", "map-stream": "~0.1", - "node-sass": "2.0.0-beta", + "node-sass": "^2.0.1", "vinyl-sourcemaps-apply": "~0.1.1" }, "devDependencies": { diff --git a/test/test.js b/test/test.js index 9064a29..53cab23 100644 --- a/test/test.js +++ b/test/test.js @@ -170,14 +170,15 @@ test('sourcemaps', function (t) { // Pretend sourcemap.init() happened by mimicking // the object it would create. - sassFile.sourceMap = { - version: 3, - file: 'scss/subdir/multilevelimport.scss', - names: [], - mappings: '', - sources: [ 'scss/subdir/multilevelimport.scss' ], - sourcesContent: [ '@import "../inheritance";\n' ] - }; + + sassFile.sourceMap = '{' + + '"version": 3,' + + '"file": "scss/subdir/multilevelimport.scss",' + + '"names": [],' + + '"mappings": "",' + + '"sources": [ "scss/subdir/multilevelimport.scss" ],' + + '"sourcesContent": [ "@import ../inheritance;" ]' + + '}'; // Expected sources are relative to file.base var expectedSources = [