JSPM

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

PostCSS plugin for splitting css into multiple css files with sourcemaps support for preventing limitation of shinny ie9

Package Exports

  • postcss-esplit

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 (postcss-esplit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

PostCSS eSplit Build Status

PostCSS plugin for splitting css into multiple css files with sourcemaps support for preventing limitation of shinny ie9.

/* Input example - style.css */

.someClass {
    display: block;
}

@media (max-width: 768px) {
    p {
        color: red;
    }

    em {
        color: blue;
    }
}
/* Output example with maxSelectors = 2 */

/* style.css */
@import url(style-0.css);

.someClass {
    display: block;
}

@media (max-width: 768px) {
    p {
        color: red;
    }
}


/* style-0.css */
@media (max-width: 768px) {
    em {
        color: blue;
    }
}

Install

npm install postcss-esplit --save

Usage

postcss([ require('postcss-split')(/*opts*/) ])

See PostCSS docs for examples for your environment.

Also, starting from version 0.0.2 there are no need to place the plugin in the end of the processor plugins list.

Options

  • maxSelectors {number=4000} count of selectors exceeding which css file should be separated
  • fileName {string=%original%-%i%} template for retrieving name of separated files
    • %original% {string} name of original file
    • %i% {number} index of separated file
  • writeFiles {boolean=true} separated files should be written to the disk
  • writeSourceMaps {boolean=true} source maps of separated files should be written to the disk
  • writeImport {boolean=true} original css source should have import declaration for separated files
  • quiet {boolean-false} toggling console output

TODO

  • Check if atRules are affecting selectors count
  • Play with source maps settings
  • Separate functions to lib
  • Write more tests to cover the functions from the lib