Auto Prefix Creater in Atom,


#1

Suppose I have this code →

  box-shadow:
          0 0 0 1px yellow,
          0 0 0 2px green,
          0 0 0 3px orange;

But I want that on few click this should be autogenerated →

  -webkit-box-shadow:
      0 0 0 1px yellow,
      0 0 0 2px green,
      0 0 0 3px orange;
  -moz-box-shadow:
      0 0 0 1px yellow,
      0 0 0 2px green,
      0 0 0 3px orange;

This is just an example. Is this possible in general to do this?


#2

It’s definitely possible. You probably want to grab all the text in the editor, run it through Autoprefixer (no sense in reinventing the wheel), and then insert it back into the editor. A relatively simple package would handle that no problem. If you want an example of Autoprefixer being used, then looking at the source for Pleeease would be useful.


#3

I know that, but I thought it is doable only from atom somehow. Yes, I agree that a simple package can do this.


#4

If you wanted to write all of the logic yourself, you could do it entirely in Atom from within init.coffee. That wouldn’t be a particularly good way to do it, since someone has already developed code that uses Can I Use data to be smart about which prefixes it adds.


#5

I didn’t get this part.


Auto Generation of u1>li*3 Possible
#6

As the Autoprefixer readme says, it uses data from CanIUse.