clean-css-loader
Advanced tools
Comparing version
@@ -5,2 +5,6 @@ # Change Log | ||
## 2.0.0 | ||
- Drop support node v6 | ||
## 1.1.0 | ||
@@ -7,0 +11,0 @@ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
@@ -12,24 +12,35 @@ exports.default = cleanCssLoader; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : { default: obj }; | ||
} | ||
function cleanCssLoader(css, map) { | ||
const options = this.options ? this.options.module : false; | ||
const query = (0, _loaderUtils.getOptions)(this); | ||
const cleanCssOptions = query || (options ? options.cleancss || options["clean-css"] || options.CleanCSS : false) || {}; | ||
const callback = this.async(); | ||
return new _cleanCss.default(cleanCssOptions).minify(css, map, (err, minified) => { | ||
if (err) { | ||
return callback(err[0]); | ||
} | ||
const options = this.options ? this.options.module : false; | ||
const query = (0, _loaderUtils.getOptions)(this); | ||
const cleanCssOptions = | ||
query || | ||
(options | ||
? options.cleancss || options["clean-css"] || options.CleanCSS | ||
: false) || | ||
{}; | ||
const callback = this.async(); | ||
return new _cleanCss.default(cleanCssOptions).minify( | ||
css, | ||
map, | ||
(err, minified) => { | ||
if (err) { | ||
return callback(err[0]); | ||
} | ||
if (!cleanCssOptions.skipWarn && Array.isArray(minified.warnings)) { | ||
minified.warnings.forEach(warning => { | ||
this.emitWarning(warning.toString()); | ||
}); | ||
} | ||
if (!cleanCssOptions.skipWarn && Array.isArray(minified.warnings)) { | ||
minified.warnings.forEach(warning => { | ||
this.emitWarning(warning.toString()); | ||
}); | ||
} | ||
return callback(null, minified.styles, minified.sourceMap); | ||
}); | ||
return callback(null, minified.styles, minified.sourceMap); | ||
} | ||
); | ||
} | ||
module.exports = exports.default; | ||
module.exports = exports.default; |
{ | ||
"name": "clean-css-loader", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"main": "lib/index.js", | ||
"dependencies": { | ||
"clean-css": "^4.2.1", | ||
"loader-utils": "^1.1.0" | ||
"loader-utils": "^1.2.3" | ||
}, | ||
@@ -19,3 +19,2 @@ "peerDependencies": { | ||
"build": "babel src --out-dir lib", | ||
"format": "prettier \".babelrc\" \"test/unit/*.js\" \"src/*.js\" \"./*.js\" --write", | ||
"pretest": "yarn build", | ||
@@ -38,24 +37,23 @@ "test": "jest", | ||
"engines": { | ||
"node": ">=6.11.0" | ||
"node": ">=8.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.0.0", | ||
"@babel/core": "^7.1.0", | ||
"@babel/preset-env": "^7.0.0", | ||
"babel-core": "^7.0.0-bridge.0", | ||
"babel-eslint": "^9.0.0", | ||
"babel-jest": "^23.6.0", | ||
"babel-plugin-add-module-exports": "^1.0.0", | ||
"eslint": "^5.6.0", | ||
"eslint-config-prettier": "^3.1.0", | ||
"@babel/cli": "^7.4.4", | ||
"@babel/core": "^7.4.4", | ||
"@babel/preset-env": "^7.4.4", | ||
"babel-eslint": "^10.0.1", | ||
"babel-jest": "^24.8.0", | ||
"babel-plugin-add-module-exports": "^1.0.2", | ||
"eslint": "^5.16.0", | ||
"eslint-config-prettier": "^4.2.0", | ||
"eslint-config-webpack": "^1.2.5", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-prettier": "^2.6.2", | ||
"husky": "^1.0.0-rc.14", | ||
"jest": "^23.6.0", | ||
"lint-staged": "^7.3.0", | ||
"npm-run-all": "^4.1.3", | ||
"prettier": "^1.14.3", | ||
"rimraf": "^2.6.1" | ||
"eslint-plugin-import": "^2.17.2", | ||
"eslint-plugin-prettier": "^3.0.1", | ||
"husky": "^2.2.0", | ||
"jest": "^24.8.0", | ||
"lint-staged": "^8.1.6", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^1.17.0", | ||
"rimraf": "^2.6.3" | ||
} | ||
} |
@@ -39,23 +39,23 @@ <div align="center"> | ||
if (production) { | ||
cssUseList.push("clean-css-loader"); | ||
// or with options | ||
cssUseList.push({ | ||
loader: "clean-css-loader", | ||
options: { | ||
compatibility: "ie9", | ||
level: 2, | ||
inline: ["remote"] | ||
} | ||
}); | ||
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 | ||
} | ||
] | ||
} | ||
}; | ||
@@ -104,21 +104,21 @@ ``` | ||
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 | ||
} | ||
} | ||
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 | ||
} | ||
} | ||
}; | ||
``` |
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
17
-5.56%37
48%0
-100%6561
-0.05%Updated