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

Scoped @keyframes helper #14

Open
rtsao opened this issue Nov 30, 2015 · 0 comments
Open

Scoped @keyframes helper #14

rtsao opened this issue Nov 30, 2015 · 0 comments
Milestone

Comments

@rtsao
Copy link
Owner

rtsao commented Nov 30, 2015

There should probably be a scoped keyframe animation helper, for example:

var scopeStyles = require('scope-styles');
var scopeKeyframes = require('scoped-styles/keyframes');

var scopedAnimations = scopedKeyframes({
  foo: {
    from: {
      width: 0
    },
    to: {
      width: '100px'
    }
  }
});

scopedAnimations;
// {foo: 'foo_a4yeR'}

scopeStyles.getCss(scopedAnimations);
/*
@keyframes foo_a4yeR {
  from: {
    width: 0
  },
  to: {
    width: 100px
  }
}
*/

var scoped = scopeStyles({
  bar: {
    'animationName': scopedAnimations.foo
  }
});

Alternatively, this could be integrated into the main scopeStyles function:

var scopeStyles = require('scope-styles');

var scopedAnimations = scopeStyles({
  '@keyframes foo': {
    from: {
      width: 0
    },
    to: {
      width: '100px'
    }
  }
});

I might prefer the explicitness of the former approach, but the latter would be easier to support in the browserify transform/plugin.

@rtsao rtsao added this to the 1.0.0 milestone Nov 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant