1.1.2 • Published 2 years ago

extract-common-css v1.1.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

extract-common-css

Extract the same css to common place to reduce the duplicate codes, and reduce package size

Sort css properties to reduce reflow and repaint, for improving the performance of page render

  • Extract the same css from different files and put into a common file
  • Extract the same css from current file and put into the current file
  • Remove some redundant inherited properties

Installation

npm install extract-common-css

Usage

Add script in package.json, as follows:

// package.json
"scripts": {
  "css": "extract-css s"
}

Now you can run the script

npm run css

Configuration

There are some configurations that you can customize if the default configuration doesn't meet your demands.

Create new file named extract.css.json in the root directory of your project,

// extract.css.json 
// default configurations
{
  "entry":  "src/main.js",
  "destPath": "src/assets/css/common.less",
  "insertInfos": {
    "insertFile": "src/main.js",
    "insertContent": "import './assets/css/common.less'"
  },
  "logOutPut": "logs"
}

Description

  • entry -> filePath|Array<filePath>, the entry of collecting the style files.
  • destPath -> filePath, the destPath tell extract-common-css where to put the extracted style.
  • insertInfos -> Object, contain the infos where to import the destPath file.
  • insertFile -> filePath, which file will import the destPath file.
  • insertContent -> String, the insertContent will be put in the insertFile, default be appended to the bottom of insertFile.
  • insertPosition -> String, as a position flag, can be used to custom place where insertContent inserted.
  • logOutPut -> dirPath, the directory of logs, when common css is extracted, will generate log file.

  • sortFile -> filePath, sort css properties for single file. you can excute script as follows to get same effect.

 extract-css s sort <filePath>
  • sortFiles -> Boolean, sort css properties for all style files. you can excute script as follows to get same effect.
 extract-css s sort

NOTE: When config the sortFiles or sortFile, the extract-common-css will not extract common css between the different files.

1.1.2

2 years ago

1.1.1

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.1.0

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago