npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

post-load-plugins

v0.0.24

Published

Automatically loads plug-ins with configuration

Downloads

67

Readme

post-load-plugins

Automatically detects processor and creates a configuration for used the plugins.

Travis Build StatusAppVeyor Build Statusnodenpm versionDependency StatusXO code styleCoveralls status

npm downloadsnpmPackage Quality

Why?

Automatically detects the running environment on the basis of which creates the configuration for plugins using post-config used in the process and sorts the execution order of plugins using post-sequence.

post-config - Automatically detect all plugins installed and create a configuration for them from the description in package.json used in the process.

post-sequence - Generates the correct sequence of execution of plug-ins for the executable

At the moment the tested processors:

||| ---|---|---|

Will inform you if the plugin has not been installed:

Install

$ npm install post-load-plugins 

Note: This project is compatible with node v4+

Usage

  1. Install processor PostHTML or PostCSS or both and post-load-plugins
$ npm install postcss posthtml post-load-plugins 
  1. Install plugins for your processor
$ npm install autoprefixer postcss-at-rules-variables postcss-csso posthtml-bem posthtml-beautify
  1. Optional Create configuration for plugins is different from the default in package.json.

For plugins not having configuration installed locally will be used default settings.

"postcss":{
  "plugins": {
    "autoprefixer": {
      "browsers": ["last 2 versions"]
    },
    "at-rules-variables": {
      "atRule": ["@media"]
    }
  }
},
"posthtml": {
  "bem": {
    "elemPrefix": "__",
    "modPrefix": "--",
    "modDlmtr": "-"
  }
}

Attention, it is recommended to use notation as above for postcss postcss: { plugins: { ... } }, but both types are supported notation posthtml: { bem: { ... }, plugins: { beautify: { ... } } }.

The names of the plugins it is recommended to use no name of the processor as described above for postcss, but supported the full name of the plugin, the plugin name without the process in kebab at-rules-variables and camel case atRulesVariables.

Example

using PostCSS

package.json

"name": "my-post-project",
"devDependencies": {
    "autoprefixer": "^6.5.4",
    "postcss": "^5.2.6",
    "postcss-csso": "^1.1.2"
},
"postcss":{
  "plugins": {
    "autoprefixer": {
      "browsers": ["last 2 versions"]
    }
  }
}

index.js

import postcss from 'postcss';
import postLoadPlugins from 'post-load-plugins';

postcss(postLoadPlugins()).process('.test { display: flex; color: #ff0000;} @charset "utf-8";');
// Result => .test{display:-ms-flexbox;display:flex;color:red}

Will apply autoprefixer with option described in the configuration "browsers": ["last 2 versions"] and postcss-csso with default settings

--

using PostHTML

package.json

"name": "my-post-project",
"devDependencies": {
    "posthtml": "^0.9.0",
    "posthtml-bem": "^0.2.2",
    "posthtml-beautify": "0.1.0"
},
"posthtml": {
  "bem": {
    "elemPrefix": "__",
    "modPrefix": "--",
    "modDlmtr": "-"
  }
}

index.js

import posthtml from 'posthtml';
import postLoadPlugins from 'post-load-plugins';

const html = `
  <div block="content">
    <h1 elem="title">Title</h1>
    <p elem="text" mods="red">Text</p>
  </div>
`;

posthtml(postLoadPlugins()).process(html);
//  Result =>
//  <div class="content">
//    <h1 class="content__title">Title</h1>
//
//    <p class="content__text content__text--red">Text</p>
//  </div>

Will apply posthtml-bem with option described in the configuration "elemPrefix": "__","modPrefix": "--","modDlmtr": "-" and posthtml-beautify with default settings

Options

extends

Type: Array
Default: []
Description: May contain an Object with properties or path to config for the expansion

extend.config.json

"bem": {
  "modPrefix": "---"
}

Will automatically try to determine if you do not specify a process name in the package name or the package does not reside in the property matching process

index.js

import posthtml from 'posthtml';
import postLoadPlugins from 'post-load-plugins';

const html = `
  <div block="content">
    <h1 elem="title">Title</h1>
    <p elem="text" mods="red">Text</p>
  </div>
`;

posthtml(postLoadPlugins({extends: ['path/to/file/extend.config.json']})).process(html);

//  Result =>
//  <div class="content">
//    <h1 class="content__title">Title</h1>
//
//    <p class="content__text content__text---red">Text</p>
//  </div>

Expand the current configuration for posthtml plugins bem