From 99bf97e297f378662e39539a13a52e77f30a03cf Mon Sep 17 00:00:00 2001 From: Nathan Cahill Date: Fri, 28 Apr 2017 14:37:08 -0700 Subject: [PATCH] v1.0.3 --- dist/rollup-plugin-collect-sass.js | 28 +++++++++++++++------------- package.json | 2 +- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/dist/rollup-plugin-collect-sass.js b/dist/rollup-plugin-collect-sass.js index ba32869..bb4460f 100644 --- a/dist/rollup-plugin-collect-sass.js +++ b/dist/rollup-plugin-collect-sass.js @@ -173,22 +173,24 @@ var index = function (options) { match = findRegex.exec(source); } - // Transform sass - var css = sass.renderSync({ - data: accum, - includePaths: ['node_modules'], - }).css.toString(); - - if (!extract) { - var injected = injectFnName + "(" + (JSON.stringify(css)) + ");"; + if (accum) { + // Transform sass + var css = sass.renderSync({ + data: accum, + includePaths: ['node_modules'], + }).css.toString(); + + if (!extract) { + var injected = injectFnName + "(" + (JSON.stringify(css)) + ");"; + + // Replace first instance with output. Remove all other instances + return source.replace(replaceRegex, injected).replace(findRegex, '') + } - // Replace first instance with output. Remove all other instances - return source.replace(replaceRegex, injected).replace(findRegex, '') + // Store css for writing + cssExtract = css; } - // Store css for writing - cssExtract = css; - // Remove all other instances return source.replace(findRegex, '') }, diff --git a/package.json b/package.json index b9a087e..e6ce414 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rollup-plugin-collect-sass", - "version": "1.0.2", + "version": "1.0.3", "description": "Transform Sass in a single context", "main": "dist/rollup-plugin-collect-sass.js", "files": "dist",