hexo-clean-css
Advanced tools
Comparing version 0.0.3 to 1.0.0
@@ -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 | ||
[![Build Status](https://travis-ci.org/hexojs/hexo-clean-css.svg?branch=master)](https://travis-ci.org/hexojs/hexo-clean-css) | ||
[![NPM version](https://badge.fury.io/js/hexo-clean-css.svg)](https://www.npmjs.com/package/hexo-clean-css) | ||
@@ -4,0 +6,0 @@ Minify CSS files with [clean-css]. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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
5
24
1
25
3230
5
+ Addedmicromatch@^4.0.2
+ Addedbluebird@3.7.2(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedclean-css@4.2.4(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedto-regex-range@5.0.1(transitive)
- Removedminimatch@^3.0.1
- Removedobject-assign@^2.0.0
- Removedamdefine@1.0.1(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbluebird@2.11.0(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedclean-css@3.4.28(transitive)
- Removedcommander@2.8.1(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedgraceful-readlink@1.0.1(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedobject-assign@2.1.1(transitive)
- Removedsource-map@0.4.4(transitive)
Updatedbluebird@^3.5.5
Updatedclean-css@^4.2.1