Skip to content
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

Don't leak opts as a global variable. #13

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ var defaults = {

module.exports = postcss.plugin('postcss-css-variables', function(options) {

opts = extend({}, defaults, options);
var opts = extend({}, defaults, options);

// Work with opts here

Expand Down Expand Up @@ -225,7 +225,7 @@ module.exports = postcss.plugin('postcss-css-variables', function(options) {
ruleToWorkOn.nodes.slice(0).forEach(function(node) {
if(node.type == 'decl') {
var decl = node;
resolveDecl(decl, map);
resolveDecl(decl, map, opts);
}
});
});
Expand Down
2 changes: 1 addition & 1 deletion lib/resolve-decl.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var cloneSpliceParentOntoNodeWhen = require('./clone-splice-parent-onto-node-whe

// Resolve the decl with the computed value
// Also add in any media queries that change the value as necessary
function resolveDecl(decl, map, /*optional*/logResolveValueResult) {
function resolveDecl(decl, map, opts, /*optional*/logResolveValueResult) {
var _logResolveValueResult = function(valueResults) {
if(logResolveValueResult) {
logResolveValueResult(valueResults);
Expand Down
2 changes: 1 addition & 1 deletion playground/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10219,7 +10219,7 @@ System.register("npm:postcss-css-variables@0.3.8/lib/resolve-decl", ["npm:postcs
var isNodeUnderScope = require("npm:postcss-css-variables@0.3.8/lib/is-node-under-scope");
var findNodeAncestorWithSelector = require("npm:postcss-css-variables@0.3.8/lib/find-node-ancestor-with-selector");
var cloneSpliceParentOntoNodeWhen = require("npm:postcss-css-variables@0.3.8/lib/clone-splice-parent-onto-node-when");
function resolveDecl(decl, map, logResolveValueResult) {
function resolveDecl(decl, map, opts, logResolveValueResult) {
var _logResolveValueResult = function(valueResults) {
if (logResolveValueResult) {
logResolveValueResult(valueResults);
Expand Down