clean-css-loader
Advanced tools
Comparing version
103
package.json
{ | ||
"name": "clean-css-loader", | ||
"version": "0.1.4", | ||
"description": "CleanCSS loader module for webpack", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"test:clean": "rimraf ./test/tmp ./test/node_modules ./test/bundle.js ./test/package.json ./test/package-lock.json && cd test && mkdir node_modules && echo {} > package.json", | ||
"pretest:webpack:1": "npm run test:clean && cd test && npm i css-loader@0.14.0 raw-loader@0.5.1 testem@0.8.3 webpack@1 ./.. && \"./node_modules/.bin/webpack\" --config webpack@1.config.js", | ||
"pretest:webpack:3": "npm run test:clean && cd test && npm i css-loader raw-loader testem webpack@3 ./.. && \"./node_modules/.bin/webpack\" --config webpack@3.config.js", | ||
"test:webpack:1": "cd ./test/tmp && echo {\\\"framework\\\": \\\"mocha+chai\\\"} > testem.json && \"../node_modules/.bin/testem\" ci -l $browser", | ||
"test:webpack:3": "cd ./test/tmp && echo {\\\"framework\\\": \\\"mocha+chai\\\"} > testem.json && \"../node_modules/.bin/testem\" ci -l $browser", | ||
"pretest": "npm run compile", | ||
"test": "echo $browser && npm run test:webpack:3 && npm run test:webpack:1", | ||
"posttest": "npm run test:clean", | ||
"lint": "eslint ./**/*.js", | ||
"compile": "babel lib --out-dir dist" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/retyui/clean-css-loader.git" | ||
}, | ||
"keywords": [ | ||
"CleanCSS", | ||
"webpack", | ||
"loader" | ||
], | ||
"author": { | ||
"name": "David Narbutovich", | ||
"email": "vamnemne@gmail.com", | ||
"url": "https://github.com/retyui" | ||
}, | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/retyui/clean-css-loader/issues" | ||
}, | ||
"homepage": "https://github.com/retyui/clean-css-loader#readme", | ||
"dependencies": { | ||
"clean-css": "^4.1.9", | ||
"loader-utils": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.24.1", | ||
"babel-eslint": "^7.2.3", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-preset-env": "^1.5.2", | ||
"babel-register": "^6.24.1", | ||
"rimraf": "^2.6.1" | ||
} | ||
"name": "clean-css-loader", | ||
"version": "1.0.0", | ||
"main": "lib/index.js", | ||
"dependencies": { | ||
"clean-css": "^4.1.9", | ||
"loader-utils": "^1.1.0" | ||
}, | ||
"peerDependencies": { | ||
"webpack": "^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0" | ||
}, | ||
"scripts": { | ||
"update-e2e": "reset ; yarn build ; yarn e2e; yarn test", | ||
"force-clean": "rimraf ./test/e2e/webpack*/node_modules/ ./test/e2e/webpack*/tests/**/*.test.js", | ||
"install-sub": "yarn link ; cd ./test/e2e/webpack1 ; yarn ; yarn link clean-css-loader ; yarn build ; cd ../webpack4 ; yarn ; yarn link clean-css-loader ; yarn build ; cd ../../..", | ||
"e2e": "yarn force-clean ; yarn install-sub", | ||
"prebuild": "rimraf ./lib", | ||
"build": "babel src --out-dir lib", | ||
"pretest": "yarn build", | ||
"test": "jest", | ||
"coverage": "nyc --clean yarn test --coverage", | ||
"precommit": "lint-staged" | ||
}, | ||
"description": "CleanCSS loader module for webpack", | ||
"keywords": [ | ||
"CleanCSS", | ||
"webpack", | ||
"loader" | ||
], | ||
"repository": "https://github.com/retyui/clean-css-loader", | ||
"author": "David <vamnemne@gmail.com>", | ||
"license": "MIT", | ||
"files": [ | ||
"lib" | ||
], | ||
"engines": { | ||
"node": ">=4.0.0" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.26.3", | ||
"babel-eslint": "^8.2.3", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-preset-env": "^1.6.1", | ||
"eslint": "^4.19.1", | ||
"eslint-config-prettier": "^2.9.0", | ||
"eslint-config-webpack": "^1.2.5", | ||
"eslint-plugin-import": "^2.11.0", | ||
"eslint-plugin-prettier": "^2.6.0", | ||
"husky": "0.14.3", | ||
"jest": "^22.4.3", | ||
"lint-staged": "7.0.5", | ||
"npm-run-all": "^4.1.2", | ||
"nyc": "^11.7.1", | ||
"prettier": "1.12.1", | ||
"rimraf": "^2.6.1" | ||
} | ||
} |
124
README.md
<div align="center"> | ||
<img src="https://cdn.rawgit.com/jakubpawlowicz/clean-css/master/logo.v2.svg" alt="clean-css logo" width="525px"/> | ||
<br> | ||
<a href="https://github.com/webpack/webpack"> | ||
<img width="200" height="200" | ||
src="https://webpack.js.org/assets/icon-square-big.svg"> | ||
</a> | ||
<img src="https://cdn.rawgit.com/jakubpawlowicz/clean-css/master/logo.v2.svg" alt="clean-css logo" width="500"/> | ||
<br> | ||
<a href="https://github.com/webpack/webpack"> | ||
<img width="200" height="200" | ||
src="https://webpack.js.org/assets/icon-square-big.svg"> | ||
</a> | ||
</div> | ||
A [clean-css](https://github.com/jakubpawlowicz/clean-css) loader for [webpack](https://github.com/webpack/webpack). | ||
# Clean-CSS-loader [](https://travis-ci.org/retyui/clean-css-loader) [](https://badge.fury.io/js/clean-css-loader) [](https://david-dm.org/retyui/clean-css-loader) | ||
# clean-css-loader | ||
[](https://www.npmjs.com/package/clean-css-loader) | ||
[](https://www.npmjs.com/package/clean-css-loader) | ||
[](https://travis-ci.org/retyui/clean-css-loader) | ||
[](https://codeclimate.com/github/retyui/clean-css-loader) | ||
[](https://codeclimate.com/github/retyui/clean-css-loader/coverage) | ||
[](https://greenkeeper.io/) | ||
## Install | ||
`npm i -D clean-css-loader` <em>or</em> `yarn add clean-css-loader --dev` | ||
```bash | ||
# for webpack@4 or 3 or 2 | ||
yarn add -D clean-css-loader | ||
# for webpack@1.x | ||
yarn add -D clean-css-loader@0.14.0 | ||
``` | ||
## Usage | ||
@@ -26,35 +38,37 @@ | ||
**webpack.config.js** | ||
```js | ||
const production = false; | ||
const cssUseList = [ 'style-loader', 'css-loader' ]; | ||
const cssUseList = ["style-loader", "css-loader"]; | ||
if(production){ | ||
cssUseList.push('clean-css-loader'); | ||
// or | ||
cssUseList.push({ | ||
loader: 'clean-css-loader', | ||
options: { | ||
compatibility: 'ie9', | ||
level: 2, | ||
inline: ['remote'] | ||
} | ||
}); | ||
if (production) { | ||
cssUseList.push("clean-css-loader"); | ||
// or with options | ||
cssUseList.push({ | ||
loader: "clean-css-loader", | ||
options: { | ||
compatibility: "ie9", | ||
level: 2, | ||
inline: ["remote"] | ||
} | ||
}); | ||
} | ||
module.exports = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: cssUseList | ||
} | ||
] | ||
} | ||
} | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: cssUseList | ||
} | ||
] | ||
} | ||
}; | ||
``` | ||
**In your application** | ||
```js | ||
import cssMin from 'style.css'; | ||
import cssMin from "style.css"; | ||
``` | ||
@@ -69,4 +83,5 @@ | ||
**In your application** | ||
```js | ||
import cssMin from 'style.css'; | ||
import cssMin from "style.css"; | ||
``` | ||
@@ -77,10 +92,11 @@ | ||
**In your application** | ||
```js | ||
import cssMin from 'style-loader!css-loader!clean-css-loader!./style.css'; | ||
import cssMin from "style-loader!css-loader!clean-css-loader!./style.css"; | ||
``` | ||
## Options | ||
### `skipWarn` default: `false` | ||
This option disable output warnings | ||
@@ -93,24 +109,24 @@ | ||
**Example config (for webpack 1.x):** | ||
```js | ||
... | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.css$/, | ||
loader: 'css!clean-css' | ||
}, | ||
{ | ||
test: /\.styl$/, | ||
loader: 'css!clean-css!stylus?reslve url' | ||
} | ||
//... | ||
] | ||
// Example Set options (Key "clean-css" or cleancss or CleanCSS): | ||
"clean-css":{ | ||
debug:true, | ||
mediaMerging: true | ||
module.exports = { | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.css$/, | ||
loader: "css!clean-css" | ||
}, | ||
{ | ||
test: /\.styl$/, | ||
loader: "css!clean-css!stylus?reslve url" | ||
} | ||
//... | ||
], | ||
// Example Set options (Key "clean-css" or cleancss or CleanCSS): | ||
"clean-css": { | ||
debug: true, | ||
mediaMerging: true | ||
} | ||
} | ||
} | ||
}; | ||
``` | ||
[](https://nodei.co/npm/clean-css-loader/) |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
7090
5.19%129
14.16%3
50%17
183.33%30
-3.23%1
Infinity%1
Infinity%