hexo-clean-css
Advanced tools
Comparing version
@@ -1,7 +0,9 @@ | ||
var assign = require('object-assign'); | ||
'use strict'; | ||
hexo.config.clean_css = assign({ | ||
/* global hexo */ | ||
hexo.config.clean_css = Object.assign({ | ||
exclude: ['*.min.css'] | ||
}, hexo.config.clean_css); | ||
hexo.extend.filter.register('after_render:css', require('./lib/filter')); | ||
hexo.extend.filter.register('after_render:css', require('./lib/filter')); |
@@ -1,19 +0,18 @@ | ||
var CleanCSS = require('clean-css'); | ||
var minimatch = require('minimatch'); | ||
var Promise = require('bluebird'); | ||
'use strict'; | ||
module.exports = function(str, data){ | ||
var options = this.config.clean_css; | ||
var path = data.path; | ||
var exclude = options.exclude; | ||
if (exclude && !Array.isArray(exclude)) exclude = [exclude]; | ||
const CleanCSS = require('clean-css'); | ||
const micromatch = require('micromatch'); | ||
const Promise = require('bluebird'); | ||
if (path && exclude && exclude.length){ | ||
for (var i = 0, len = exclude.length; i < len; i++){ | ||
if (minimatch(path, exclude[i])) return str; | ||
} | ||
module.exports = function(str, data) { | ||
const options = this.config.clean_css; | ||
const path = data.path; | ||
const exclude = options.exclude; | ||
if (path && exclude && exclude.length) { | ||
if (micromatch.isMatch(path, exclude, { basename: true })) return str; | ||
} | ||
return new Promise(function(resolve, reject){ | ||
new CleanCSS(options).minify(str, function(err, result){ | ||
return new Promise((resolve, reject) => { | ||
new CleanCSS(options).minify(str, (err, result) => { | ||
if (err) return reject(err); | ||
@@ -23,2 +22,2 @@ resolve(result.styles); | ||
}); | ||
}; | ||
}; |
{ | ||
"name": "hexo-clean-css", | ||
"version": "0.0.3", | ||
"version": "1.0.0", | ||
"description": "Minify CSS files with clean-css.", | ||
"main": "index", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "gulp test" | ||
"eslint": "eslint .", | ||
"test": "mocha test/index.js", | ||
"test-cov": "nyc npm run test" | ||
}, | ||
"files": [ | ||
"lib/" | ||
], | ||
"directories": { | ||
"lib": "./lib" | ||
}, | ||
"engines": { | ||
"node": ">= 0.10.0" | ||
}, | ||
"repository": "hexojs/hexo-clean-css", | ||
@@ -21,25 +23,22 @@ "keywords": [ | ||
], | ||
"author": "Tommy Chen <tommy351@gmail.com> (http://zespia.tw)", | ||
"author": "Tommy Chen <tommy351@gmail.com> (http://zespia.tw)", | ||
"maintainers": [ | ||
"Abner Chou <hi@abnerchou.me> (http://abnerchou.me)" | ||
], | ||
], | ||
"license": "MIT", | ||
"dependencies": { | ||
"bluebird": "^2.9.4", | ||
"clean-css": "^3.0.8", | ||
"minimatch": "^3.0.1", | ||
"object-assign": "^2.0.0" | ||
"bluebird": "^3.5.5", | ||
"clean-css": "^4.2.1", | ||
"micromatch": "^4.0.2" | ||
}, | ||
"devDependencies": { | ||
"chai": "^1.9.1", | ||
"coveralls": "^2.11.2", | ||
"gulp": "^3.8.9", | ||
"gulp-istanbul": "^0.5.0", | ||
"gulp-jshint": "^1.8.6", | ||
"gulp-load-plugins": "^0.8.0", | ||
"gulp-mocha": "^2.0.0", | ||
"jshint-stylish": "^1.0.0", | ||
"mocha": "^2.0.1", | ||
"rimraf": "^2.2.8" | ||
"chai": "^4.2.0", | ||
"eslint": "^6.1.0", | ||
"eslint-config-hexo": "^3.0.0", | ||
"mocha": "^6.1.4", | ||
"nyc": "^14.1.1" | ||
}, | ||
"engines": { | ||
"node": ">= 8.6.0" | ||
} | ||
} |
# hexo-clean-css | ||
[](https://travis-ci.org/hexojs/hexo-clean-css) | ||
[](https://www.npmjs.com/package/hexo-clean-css) | ||
@@ -4,0 +6,0 @@ Minify CSS files with [clean-css]. |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
3
-25%5
-50%24
4.35%1
-50%25
8.7%3230
-3.73%5
-16.67%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated