Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-less-changed

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-less-changed - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

release/import-lister.js

4

package.json
{
"name": "gulp-less-changed",
"version": "1.0.2",
"version": "1.1.0",
"description": "Only pass .less files through the gulp stream if they or their dependencies have changed",

@@ -39,2 +39,3 @@ "main": "release/main.js",

"mocha": "^2.4.5",
"pmock": "^0.2.3",
"proxyquire": "^1.7.4",

@@ -52,2 +53,3 @@ "semantic-release": "^4.3.5",

"less": "^2.6.0",
"object-assign": "^4.0.1",
"stream-to-array": "^2.3.0",

@@ -54,0 +56,0 @@ "through2": "^2.0.1",

@@ -94,8 +94,8 @@ # `gulp-less-changed`

### lessChanged()
### lessChanged([options])
Looks for .css files in the same directory as the input LESS files. If a LESS file has a later timestamp than its corresponding
CSS file, or if any of the LESS file's imports has a later timestamp than the CSS file, the LESS file is emitted to the stream.
For each input LESS file in the Gulp stream, looks for the corresponding CSS file. If the LESS file has a later timestamp than its
corresponding CSS file, or if any of the LESS file's imports has a later timestamp than the CSS file, the LESS file is emitted to the stream.
### lessChanged(options)
If no options are specified, looks for a CSS file in the same path as the LESS file with a .css extension. Otherwise:

@@ -105,2 +105,4 @@ * **options.getOutputFileName** - `function` Map source paths to destination paths

Overrides the default behaviour of looking for .css files in the input path.
* **options.paths** - `string[]` Search paths for `@import`s and files referenced using `data-uri`. This
works in the same way as the `paths` option for [gulp-less](https://www.npmjs.com/package/gulp-less).

@@ -107,0 +109,0 @@ ## License

@@ -19,3 +19,2 @@ 'use strict';

}(Error));
;
var ImportBuffer = (function () {

@@ -22,0 +21,0 @@ function ImportBuffer(importLister) {

@@ -6,3 +6,3 @@ 'use strict';

var gutil = require('gulp-util');
var ListImports = require('./list-imports');
var import_lister_1 = require('./import-lister');
var fsAsync = Promise.promisifyAll(fs);

@@ -12,7 +12,7 @@ var MODULE_NAME = 'gulp-less-changed';

(function (gulpLessChanged) {
function checkImportsHaveChanged(file, mainFileDate) {
function checkImportsHaveChanged(file, mainFileDate, importLister) {
function importHasChanged(importFile) {
return importFile.stat.mtime > mainFileDate;
}
return ListImports.listImports(file)
return importLister.listImports(file)
.then(function (imports) {

@@ -22,5 +22,11 @@ return imports.some(importHasChanged);

}
var listerCache = {};
function run(options) {
options = options || {};
var getOutputFileName = options.getOutputFileName || (function (input) { return gutil.replaceExtension(input, '.css'); });
var listerKey = JSON.stringify(options);
var importLister = listerCache[listerKey];
if (!importLister) {
importLister = listerCache[listerKey] = new import_lister_1.ImportLister(options);
}
function transform(file, enc, callback) {

@@ -50,3 +56,7 @@ var _this = this;

}
return checkImportsHaveChanged(file, intermediateResult.outputAge).catch(function (reason) { return false; });
return checkImportsHaveChanged(file, intermediateResult.outputAge, importLister)
.catch(function (error) {
console.error(error);
return true;
});
})

@@ -53,0 +63,0 @@ .then(function (importsHaveChanged) {

@@ -11,2 +11,3 @@ {

"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#1c56e368e17bb28ca57577250624ca5bd561aa81",
"object-assign": "registry:dt/object-assign#4.0.1+20160316155526",
"through2": "github:DefinitelyTyped/DefinitelyTyped/through2/through2.d.ts#48f20e97bfaf70fc1a9537b38aed98e9749be0ae",

@@ -13,0 +14,0 @@ "vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts#70a1f40bc8ef810b4272d37553cf86c6785be7f8"

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