WebReflection / restyle

MIT License
168 stars 8 forks source link

Looks wonderfully simple – how about taking that further? #1

Closed tomek-he-him closed 9 years ago

tomek-he-him commented 9 years ago

Hi, I’m looking for a dead simple way to translate a JS object to CSS. Your lib looks like the perfect tool for that purpose! I love the simplicity of it!

The only thing I’m concerned about is the number of fancy features here and there. If I understand the readme correctly, .transform applies a CSS transform with a JS-based fallback. Have you considered releasing that as a separate module?

I guess .animate, namespacing (through component), prefixing – these could all be separate modules which modify the input object or the output CSS. Do you see that as an option?

WebReflection commented 9 years ago

the lib is that small I never cared much, and it gave me everything I needed in one single CDN hosted file. There are also few things shared in its private scope, I'm not sure it's worth the trouble.

However, since you are asking, I wonder what kind of real-world benefits you have in mind or how would that look. Something that could be extended in a jQuery or query-result way?

tomek-he-him commented 9 years ago

I wonder what kind of real-world benefits you have in mind

I’m managing a big style framework that’ll soon be developed by multiple developers. In this case having less features is often a benefit. Because (1) when entering the team you don’t have so much to learn – and (2) a simpler system means there are less things that can break when used inappropriately.

it gave me everything I needed in one single CDN hosted file

There’s a great CDN which browserifies things for you and caches the browserified stuff. http://wzrd.in. I use it in https://github.com/parametric-svg/js for example.

how would that look

I’m a fan of simple, composable functions. For example:

const namespace = require('restyle-namespace');

namespace({
  name: 'my-component',
  separator: '--',
}, {
  '.a': {
    margin: '0 auto',
  },
  '.b': {
    padding: '0',
  },
});
//» {
//    '.my-component--a': {
//      margin: '0 auto',
//    },
//    '.my-component--b': {
//      padding: '0',
//    },
//  }
WebReflection commented 9 years ago

so, the CDN here is cdnJS and I am not planning to change that. Your change also would inevitably require browserrify or some other module logic in place per each plugin. It's OKish but it breaks what's in akready and is already used in production.

There are only two methods in this file, and the size is still irrelevant (around 1KB) ... so, what is the real-world benefit in splitting this file? What kind of real-world problems you had?

tomek-he-him commented 9 years ago

I’m at the point of choosing whether to use this library, use another one or write my own. So the only problem I’ve had so far is understanding the readme – what these .animate things do.

But in fact any similar libraries I’ve found are more bloated than yours.

I’ve named the benefits above. So if you don’t agree with me, feel free to close this issue. I’ll probably give your library a shot anyway – and perhaps write a compatible restyle-lite some time later.

WebReflection commented 9 years ago

If the documentation is crap, which it is, I can improve that. I've written quickly new features but had not so many "new stars" recently, meaning I was rather waiting for someone to ask me more, which is the case.

Also those two methods were kinda implemented on demand, accordingly with my very own specific needs to solve my very own specific problems ... so probably not perfect, but I didn't get stuck and moved on with that project.

There's plenty of room for improvements here, but just splitting such small file with two extra utilities attached doesn't seem like my highest priority.

There are also other files already somehow placed a part and usable, all in the build folder.

Maybe, if you want, you can give it a go and open a bug about how much the documentation sucks.

I'd be happier to fix that which is an actual concrete problems of this library.

I'll close this for now, hope you don't mind.

Cheers

tomek-he-him commented 9 years ago

It seems like the only part I’m going to need to get started now are the specs – which are great. But I can open an issue if you want.

Thanks for the reply, cheers!