UNPKG

stylis-plugin-extra-scope

Version:

Stylis plugin which adds extra scope to each produced CSS rule.

31 lines (22 loc) 752 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); function createExtraScopePlugin() { for (var _len = arguments.length, extra = new Array(_len), _key = 0; _key < _len; _key++) { extra[_key] = arguments[_key]; } var scopes = extra.map(function (scope) { return scope.trim(); }); var extraScopePlugin = function extraScopePlugin(context, content, selectors, parents, line, column, length, type) { if (context !== -1) { return; } var selector = selectors[0]; selectors[0] = scopes[0] + " " + selector; for (var i = 1; i < scopes.length; i++) { selectors.push(scopes[i] + " " + selector); } }; return extraScopePlugin; } exports.default = createExtraScopePlugin;