Skip to content

Commit

Permalink
add static name property to plugin (#2)
Browse files Browse the repository at this point in the history
* name the exported default function

in styled-components we're introducing some functionality that
needs named stylis plugins

* make it more minification-safe
  • Loading branch information
quantizor committed Dec 29, 2019
1 parent c9e6acb commit 09843e6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/stylis-rtl.js
Expand Up @@ -18,8 +18,15 @@ export type StylisContextType = $Values<typeof STYLIS_CONTEXTS>;
// (they are not present at the PROPERTY, SELECTOR_BLOCK, or POST_PROCESS steps)
export const STYLIS_PROPERTY_CONTEXT = STYLIS_CONTEXTS.PREPARATION;

export default (context: StylisContextType, content: string): ?string => {
function stylisRTLPlugin(context: StylisContextType, content: string): ?string {
if (context === STYLIS_PROPERTY_CONTEXT) {
return cssjanus.transform(content);
}
};
}

// stable identifier that will not be dropped by minification unless the whole module
// is unused
/*#__PURE__*/
Object.defineProperty(stylisRTLPlugin, "name", { value: "stylisRTLPlugin" });

export default stylisRTLPlugin;

0 comments on commit 09843e6

Please sign in to comment.