Skip to content

API #2

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

Closed
mxstbr opened this issue Nov 9, 2016 · 10 comments
Closed

API #2

mxstbr opened this issue Nov 9, 2016 · 10 comments

Comments

@mxstbr
Copy link
Member

mxstbr commented Nov 9, 2016

Not sure how much or little this module should do.

It could do the whole CSS string -> ReactNative object thing, but it could also just be responsible for the ReactNative specific styles:

import transform from 'css-to-react-native';

// ...

declarations.forEach(decl => { styles[decl.property] = transform(decl.value) })

In this case it would just check if it's one of the special reactnative declarations and then transform just those, otherwise return the value unchanged.

What do you think?

@jacobp100
Copy link
Contributor

I think we should have the default export be string => style map, but also expose declaration[] => stylemap. I don't think it's safe to assume 1 declaration = 1 property, since it would be nice to allow shorthands at some point.

@mxstbr
Copy link
Member Author

mxstbr commented Nov 9, 2016

Sure, you go ahead then, I'm sure you've thought about this more than I have! :D

@jacobp100
Copy link
Contributor

jacobp100 commented Nov 11, 2016

I’ve settled on the following API.

transform([
  ['border-width', '3 4'],
  ['font', '12/18 "Helvetica"'],
]);

This is so we aren’t dependent on postCSS. People using postCSS can just do,

transform(decls.map(decl => [decl.name, decl.value]));

Should be ready unless you have further comments.

@mxstbr
Copy link
Member Author

mxstbr commented Nov 11, 2016

Sounds good to me!

@jacobp100
Copy link
Contributor

Neat! Should be ready to publish—just run npm run build first!

@mxstbr
Copy link
Member Author

mxstbr commented Nov 17, 2016

Sorry man, I totally dropped the ball on this! Back on it, let's land this! 🎉

@mxstbr
Copy link
Member Author

mxstbr commented Nov 17, 2016

Published v1.0.0 and added you on npm!

@mxstbr mxstbr closed this as completed Nov 17, 2016
@jacobp100
Copy link
Contributor

jacobp100 commented Nov 17, 2016

@mxstbr Hi sorry. Would it be possible to run npm build and republish. It’s my fault, I should really learn how to use the npm publish scripts! Just saw you added me on NPM. I’ll fix this!

@mxstbr
Copy link
Member Author

mxstbr commented Nov 17, 2016

You can totally do that yourself, I've added you on npm, but I'll do it this time!

@jacobp100
Copy link
Contributor

Just noticed that. Thanks! I’ve just added the prepublish hook now!

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

No branches or pull requests

2 participants