builder-autoprefixer
Advanced tools
Comparing version 0.0.0 to 0.0.1
33
index.js
@@ -1,12 +0,37 @@ | ||
var autoprefixer = require('autoprefixer'); | ||
var autoprefix = require('autoprefixer'); | ||
var crypto = require('crypto'); | ||
module.exports = function (browsers) { | ||
return function autoprefix(file, done) { | ||
var cache = Object.create(null); | ||
module.exports = function (options) { | ||
options = options || {}; | ||
var browsers = options.browsers; | ||
if (Array.isArray(browsers)) browsers = browsers.join(', '); | ||
if (browsers) autoprefix = autoprefix(browsers); | ||
else browsers = ''; | ||
return function autoprefixer(file, done) { | ||
if (file.extension !== 'css') return done(); | ||
file.read(function (err, string) { | ||
if (err) return done(err); | ||
file.string = autoprefixer(browsers).process(string).css | ||
var hash = browsers + calculate(string); | ||
var res; | ||
try { | ||
res = cache[hash] = cache[hash] || autoprefix.process(string); | ||
} catch (err) { | ||
done(err); | ||
return; | ||
} | ||
file.string = res.css; | ||
done(); | ||
}) | ||
} | ||
} | ||
function calculate(string) { | ||
return crypto.createHash('md5') | ||
.update(string) | ||
.digest('hex'); | ||
} |
{ | ||
"name": "builder-autoprefixer", | ||
"description": "autoprefixer plugin for component-builder2.js", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"author": { | ||
"name": "Jonathan Ong", | ||
"email": "me@jongleberry.com", | ||
"url": "http://jongleberry.com", | ||
"twitter": "https://twitter.com/jongleberry" | ||
"url": "http://jongleberry.com" | ||
}, | ||
@@ -14,23 +13,12 @@ "license": "MIT", | ||
"type": "git", | ||
"url": "https://github.com/component/builder-autoprefixer.git" | ||
"url": "https://github.com/component/autoprefixer.git" | ||
}, | ||
"bugs": { | ||
"mail": "me@jongleberry.com", | ||
"url": "https://github.com/component/builder-autoprefixer/issues" | ||
"url": "https://github.com/component/autoprefixer/issues" | ||
}, | ||
"dependencies": { | ||
"buffer-crc32": "*", | ||
"autoprefixer": "*" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^1.17.0", | ||
"should": "^3.0.0", | ||
"gnode": "~0.0.6", | ||
"regenerator": "~0.3.4" | ||
}, | ||
"scripts": { | ||
"test": "NODE=gnode make test" | ||
}, | ||
"engines": { | ||
"node": ">= 0.11.4" | ||
} | ||
"homepage": "https://github.com/component/autoprefixer" | ||
} |
# Builder Autoprefixer | ||
Autoprefixer plugin for [component-builder2](https://github.com/component/builder2.js) using [autoprefixer](https://github.com/ai/autoprefixer). | ||
Autoprefixes your CSS files one by one so that it's streaming! | ||
Autoprefixer plugin for [component-builder2](https://github.com/component/builder2.js). Caches to create incremental builds. | ||
@@ -10,10 +9,7 @@ ## API | ||
var build = require('component-builder2') | ||
var autoprefixer = require('builder-autoprefixer') | ||
var autoprefix = require('builder-autoprefixer') | ||
var browsers = ["last 1 version", "BlackBerry 10", "Android 4"] | ||
build.styles(branches, options) | ||
.use('styles', | ||
build.plugins.css(), | ||
autoprefixer(browsers)) | ||
autoprefix('last 2 versions')) | ||
.pipe(process.stdout) | ||
@@ -20,0 +16,0 @@ ``` |
Sorry, the diff of this file is not supported yet
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
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
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
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
3587
0
30
0
2
2
2
39
+ Addedbuffer-crc32@*
+ Addedbuffer-crc32@1.0.0(transitive)