diff --git a/src/exports.js b/src/exports.js index b86f3d3..fb88fbb 100644 --- a/src/exports.js +++ b/src/exports.js @@ -9,6 +9,7 @@ import { addRenderedClassNames, getRenderedClassNames, getBufferedStyles, + setStyleTagSuffix, } from './inject'; import {defaultSelectorHandlers} from './generate'; @@ -188,5 +189,6 @@ export default function makeExports( flushToStyleTag, injectAndGetClassName, defaultSelectorHandlers, + setStyleTagSuffix, }; } diff --git a/src/index.js b/src/index.js index 78c35bf..6bcdf67 100644 --- a/src/index.js +++ b/src/index.js @@ -13,6 +13,7 @@ const { flushToStyleTag, injectAndGetClassName, defaultSelectorHandlers, + setStyleTagSuffix, } = Aphrodite; export { @@ -24,4 +25,5 @@ export { flushToStyleTag, injectAndGetClassName, defaultSelectorHandlers, + setStyleTagSuffix, }; diff --git a/src/inject.js b/src/inject.js index c5c85d9..4dff2a5 100644 --- a/src/inject.js +++ b/src/inject.js @@ -16,6 +16,12 @@ import type { SelectorHandler } from './generate.js'; // `document.querySelector("style[data-aphrodite"])`, but holding onto it is // faster. let styleTag /* : ?HTMLStyleElement */ = null; +let styleTagSuffix = ''; +const styleTagAttribute = () => `data-aphrodite${styleTagSuffix ? '-' + styleTagSuffix : ''}`; + +export const setStyleTagSuffix = suffix => { + styleTagSuffix = suffix; +}; // Inject a set of rules into a