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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

List plugins inside plugin packs #21

Open
ben-eb opened this issue Sep 25, 2015 · 13 comments
Open

List plugins inside plugin packs #21

ben-eb opened this issue Sep 25, 2015 · 13 comments

Comments

@ben-eb
Copy link
Collaborator

ben-eb commented Sep 25, 2015

It would be good to list plugins as parts of plugin packs. So for example cssnext uses postcss-selector-matches, and at least a handful of plugins use postcss-reporter. Would be great if those connections were realised in this list. 馃槃

Would be nice also to list some plugins that are not included, once this is done. We decided to remove most of cssnano's plugins (there are a lot now!) from the PostCSS readme on account of the optimisations section being too big.

@himynameisdave
Copy link
Owner

Yeah this is actually super cool! Looking to add this stuff as well!

Here's how I'm thinking I'm going to implement this:

  1. Have a docs/packs.md file that displays each pack's dependant plugins.
  2. Go research the plugins used by packs like cssnano and make sure they are added to the main list

@ben-eb Make sense?

@ben-eb
Copy link
Collaborator Author

ben-eb commented Sep 25, 2015

You could also have a packs property for each plugin (array type) that would list the packs that the plugin belongs to. 馃槃

@himynameisdave
Copy link
Owner

That is so much smarter/better, and then if I really wanted to generate that packs.md it would be so much easier because that data would be available.

@ben-eb
Copy link
Collaborator Author

ben-eb commented Sep 25, 2015

Alright, I'll send a patch for cssnano's plugins. 馃槃

@jonathantneal
Copy link
Collaborator

I would rather the packs identify which plugins they utilize. This might be inferable from package.json

@himynameisdave
Copy link
Owner

I like both of these ideas... so here's what I think is the most comprehensive:

{
  "name": "cool-plugin-pack",
  "tags": [
    "pack"
  ],
  "plugins_used": [
    "a-neat-plugin",
    "other-plugin"
  ]
},{
   "name": "a-neat-plugin",
   "tags": [
     "fun"
   ],
   "packs": [
      "cool-plugin-pack"
   ]
}

(obviously I left out some properties but you get the idea...)

@ben-eb
Copy link
Collaborator Author

ben-eb commented Sep 29, 2015

We can get the other by code, surely?

@himynameisdave
Copy link
Owner

@ben-eb how do you mean? I see it being used as such:

require("postcss-plugins").forEach(function(plugin){
  if( plugin.tags.indexOf("pack") < 0 ){
    // this plugin is a pack
    // plugin.plugins_used exists and can be iterated through
  }else{
     if( plugin.packs ){
       // this plugin is part of a pack, and plugin.packs can be iterated through
     }else{
       // this plugin is not a pack or part of a pack
     }
  }
});

Should there just be like an isPack property instead so that initial check is easier?

@ben-eb
Copy link
Collaborator Author

ben-eb commented Sep 29, 2015

I mean that you can infer the relationship between the pack & each of its plugins without needing two properties, whichever you choose.

@himynameisdave
Copy link
Owner

....but what do you think is the best course of action? Tell me, I wanna know - what would you do?

@ben-eb
Copy link
Collaborator Author

ben-eb commented Sep 29, 2015

I already started using the packs property in the last pull request, so I would go with that. 馃槃

@jonathantneal
Copy link
Collaborator

Related to #13, might we use https://registry.npmjs.org/${ name }/latest to get the list of dependencies as dependencies? We could use this to report the number of dependencies or what those dependencies are, as well as detect when those dependencies are other PostCSS plugins.

@himynameisdave
Copy link
Owner

Well we kind of already have the packs property in the dataset, I'm not sure there is a ton of value in adding dependencies as well but maybe I'm wrong?

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

3 participants