JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 25
  • Score
    100M100P100Q57097F
  • License MIT

A sequence for configuration posthtml and postcss plugins

Package Exports

  • post-sequence

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (post-sequence) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

post-sequence

Sequence for configuration posthtml and postcss, sorts the configuration file based on the internal configurator.

Travis Build StatusAppVeyor Build Statusnodenpm versionDependency StatusXO code styleCoveralls status

npm downloadsnpmPackage Quality

Why?

Saves you from possible errors in the processing due to wrong wiring sequence plug-ins. You just pass in a configuration object of your processor, type of processor and reappointment or extension for internal configurator.

Install

$ npm i -S post-sequence

Note: This project is compatible with node v4+

Usage

import sequence from 'post-sequence';

const posthtmlConfig = {
  bem: {
      elemPrefix: '__',
      modPrefix: '-',
      modDlmtr: '--'
  },
  include: {
      root: './',
      encoding: 'utf-8'
  },
  styleToFile: {
      path: './dist/style.css'
  }
};

sequence(posthtmlConfig, {processor: 'posthtml', extend: {}, namespace: false});
// return ==> {"include": {...}, "bem": {...}, "styleToFile": {...}}

Returns your config sorted according to the internal configuration or according to the extended.

posthtml configuration sequence

{
  "include": {
    "priority": 998
  },
  "modules": {
    "priority": 999  
  },
  "beautify": {
    "priority": 0
  }
}

postcss configuration sequence

{
  "devtools": {
    "priority": 9999
  },
  "easyImport": {
    "priority": 9998
  },
  "import": {
    "priority": 9998
  },
  "each": {
    "priority": 9997
  },
  "mixins": {
    "priority": 9996
  },
  "atRulesVariables": {
    "priority": 9995
  },
  "customProperties": {
    "priority": 9994
  },
  "for": {
    "priority": 9993
  },
  "conditionals": {
    "priority": 9992
  },
  "nested": {
    "priority": 9991
  }
}

Options

processor

Type: string
Default: ``
Takes the processor type. There are two types posthtml and postcss

extend

Type: object
Default: {}
The extend has a higher priority, and in the case of crossing names of the plugins value is transferred to the extension will be higher than the internal configuration.

namespace

Type: boolean
Default: false
Value set to true will consider that your config contains the names of plugins with a prefix of processor

Example

Use option namespace

import sequence from 'post-sequence';

const posthtmlConfig = {
  'posthtml-bem': {
      elemPrefix: '__',
      modPrefix: '-',
      modDlmtr: '--'
  },
  'posthtml-include': {
      root: './',
      encoding: 'utf-8'
  }
};

sequence(posthtmlConfig, {processor: 'posthtml', namespace: true});
// return ==> {"posthtml-include": {...}, "posthtml-bem": {...}}

LICENSE

MIT License (MIT)

Copyright (c) Ivan Demidov scrum@list.ru

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.