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

Allow to provide custom class name replacer to serialize() #23

Merged
merged 1 commit into from
Nov 6, 2017

Conversation

asvetliakov
Copy link
Collaborator

@asvetliakov asvetliakov commented Nov 4, 2017

What:
Allow to provide custom class name replacer for serialize():

serialize(sheet, className => `my-css-${className}`)

Why:
This is very helpful if you have some babel plugin which appends component name to your class-names, i.e:

const className = "css-12345-MyComponent";
const replacer = className => className.split("-").splice(-1)[0]; // MyComponent

serializer(sheet, replacer);

How: See PR

@codecov
Copy link

codecov bot commented Nov 4, 2017

Codecov Report

Merging #23 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #23   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           2      2           
  Lines          65     66    +1     
  Branches       13     13           
=====================================
+ Hits           65     66    +1
Impacted Files Coverage Δ
src/replace-class-names.js 100% <100%> (ø) ⬆️
src/serializer.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 84ace7c...535e99d. Read the comment docs.

Copy link
Owner

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Thanks!

@kentcdodds kentcdodds merged commit a567f0e into kentcdodds:master Nov 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants