rucksack-css
Advanced tools
Comparing version
@@ -16,4 +16,3 @@ #!/usr/bin/env node | ||
'autoprefixer', | ||
'fallbacks', | ||
'colors' | ||
'fallbacks' | ||
], | ||
@@ -20,0 +19,0 @@ alias: { |
@@ -9,6 +9,4 @@ Usage: rucksack [input] [output] {OPTIONS} | ||
--no-colors Disable default color replacements. | ||
--version, -v Show the version number. | ||
--help, -h Show this help screen. |
82
index.js
@@ -5,41 +5,25 @@ 'use strict'; | ||
// Core Rucksack plugins (always used) | ||
var core = [ | ||
require('postcss-alias'), | ||
require('postcss-clearfix'), | ||
require('postcss-easings'), | ||
require('postcss-fontpath'), | ||
require('postcss-hexrgba'), | ||
require('postcss-position'), | ||
require('postcss-quantity-queries'), | ||
require('postcss-responsive-type'), | ||
require('postcss-input-style') | ||
]; | ||
var processors = { | ||
alias: require('postcss-alias'), | ||
clearFix: require('postcss-clearfix'), | ||
easings: require('postcss-easings'), | ||
fontPath: require('postcss-fontpath'), | ||
hexRGBA: require('postcss-hexrgba'), | ||
position: require('postcss-position'), | ||
quantityQueries: require('postcss-quantity-queries'), | ||
responsiveType: require('postcss-responsive-type'), | ||
inputStyles: require('postcss-input-style'), | ||
fallbacks: [ | ||
require('postcss-color-rgba-fallback'), | ||
require('postcss-epub'), | ||
require('postcss-opacity'), | ||
require('postcss-pseudoelements'), | ||
require('postcss-vmin') | ||
], | ||
autoprefixer: require('autoprefixer') | ||
}; | ||
// CSS fallbacks set (optional) | ||
var fallbacks = [ | ||
require('postcss-color-rgba-fallback'), | ||
require('postcss-epub'), | ||
require('postcss-opacity'), | ||
require('postcss-pseudoelements'), | ||
require('postcss-vmin') | ||
]; | ||
// Individual add-ons (optional) | ||
var autoprefixer = require('autoprefixer'); | ||
// colors = require('postcss-color-palette'); | ||
// Error reporting | ||
var reporter = require('postcss-reporter'); | ||
// Define a custom color palette | ||
// colors = colors({ palette: 'material' }); | ||
// Default options | ||
var defaults = { | ||
fallbacks: true, | ||
autoprefixer: true | ||
// colors: true | ||
}; | ||
// Build PostCSS plugin | ||
@@ -51,26 +35,18 @@ var rucksack = $postcss.plugin('rucksack', function(options) { | ||
// Build options with defaults | ||
options = options || {}; | ||
for (var option in defaults) { | ||
if (defaults.hasOwnProperty(option) && !options.hasOwnProperty(option)) { | ||
options[option] = defaults[option]; | ||
} | ||
} | ||
Object.keys(processors).forEach(function(feature){ | ||
var processor = processors[feature]; | ||
// Build plugin array based on options | ||
plugins = plugins.concat(core); | ||
if (options[feature] !== false) { | ||
if (options.fallbacks) { | ||
plugins = plugins.concat(fallbacks); | ||
} | ||
if (processor instanceof Array) { | ||
plugins = plugins.concat(processor); | ||
} else { | ||
plugins.push(processor); | ||
} | ||
if (options.autoprefixer) { | ||
plugins.push(autoprefixer); | ||
} | ||
} | ||
}); | ||
// if (options.colors) { | ||
// plugins.push(colors); | ||
// } | ||
plugins.push(reporter); | ||
@@ -77,0 +53,0 @@ |
{ | ||
"name": "rucksack-css", | ||
"version": "0.6.7", | ||
"version": "0.6.8", | ||
"description": "A little bag of CSS superpowers", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Potential vulnerability
Supply chain riskInitial human review suggests the presence of a vulnerability in this package. It is pending further analysis and confirmation.
Found 1 instance in 1 package
0
-100%1517657
-0.03%26598
-0.08%