Socket
Socket
Sign inDemoInstall

postcss-cli

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-cli - npm Package Compare versions

Comparing version 2.3.1 to 2.3.2

6

History.md
2.3.2 / 2015-10-27
==================
* auto-configure postcss-import support
* add support for watching multiple entry points
2.3.1 / 2015-10-25

@@ -3,0 +9,0 @@ ==================

44

index.js

@@ -72,2 +72,14 @@ var globby = require("globby");

// support for postcss-import
if (argv.use.indexOf("postcss-import") !== -1) {
var importConfig = argv["postcss-import"] || {};
argv["postcss-import"] = importConfig;
// auto-configure watch update hook
if(!importConfig.onImport) {
importConfig.onImport = function(sources) {
global.watchCSS(sources, this.from);
};
}
}
var inputFiles = globby.sync(argv._);

@@ -121,6 +133,16 @@ if (!inputFiles.length) {

if (argv.watch) {
var watchedFiles = inputFiles;
global.watchCSS = fsWatcher(inputFiles);
}
async.forEach(inputFiles, compile, onError);
function fsWatcher(entryPoints) {
var watchedFiles = entryPoints;
var index = {}; // source files by entry point
var watcher = require('chokidar').watch(watchedFiles);
watcher.on('change', function() { // TODO: support for "add", "unlink" etc.?
async.forEach(inputFiles, compile, function(err) {
// recompile if any watched file is modified
// TODO: only recompile relevant entry point
watcher.on('change', function() {
async.forEach(entryPoints, compile, function(err) {
return onError.call(this, err, true);

@@ -130,9 +152,17 @@ });

global.watchCSS = function(files) {
return function updateWatchedFiles(files, entryPoint) {
// update source files for current entry point
entryPoint = entryPoint || null;
index[entryPoint] = files;
// aggregate source files across entry points
var entryPoints = Object.keys(index);
var sources = entryPoints.reduce(function(files, entryPoint) {
return files.concat(index[entryPoint]);
}, []);
// update watch list
watcher.unwatch(watchedFiles);
watcher.add(files);
watchedFiles = files;
watcher.add(sources);
watchedFiles = sources;
};
}
async.forEach(inputFiles, compile, onError);

@@ -139,0 +169,0 @@ function compile(input, fn) {

2

package.json
{
"name": "postcss-cli",
"version": "2.3.1",
"version": "2.3.2",
"description": "CLI for postcss",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -57,5 +57,4 @@ [![Build Status](https://img.shields.io/travis/code42day/postcss-cli.svg)](http://travis-ci.org/code42day/postcss-cli)

When inlining CSS imports (e.g. with [postcss-import]), add an update handler
to your JavaScript configuration file to ensure referenced modules are taken
into account:
When inlining CSS imports, add an update handler to your JavaScript
configuration file to ensure referenced modules are taken into account:

@@ -66,3 +65,3 @@ ```js

onImport: function(sources) {
global.watchCSS(sources);
global.watchCSS(sources, this.from);
}

@@ -73,2 +72,4 @@ }

For [postcss-import], this handler is added automatically.
#### `--config|-c`

@@ -75,0 +76,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc