Socket
Socket
Sign inDemoInstall

compile-less-cli

Package Overview
Dependencies
35
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

5

lib/compile.d.ts

@@ -1,1 +0,4 @@

export {};
export interface ICompileOtion {
out: string;
combine: string;
}

55

lib/compile.js

@@ -8,5 +8,5 @@ "use strict";

var executeLess_1 = require("./executeLess");
module.exports = function compile(dir, out) {
module.exports = function compile(dir, option) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var inputDir, outputDir, files, lessSource;
var inputDir, outputDir, files, lessSource, outputCssFile, cssStr;
var _this = this;

@@ -17,3 +17,3 @@ return tslib_1.__generator(this, function (_a) {

inputDir = path_1.default.join(process.cwd(), dir);
outputDir = path_1.default.join(process.cwd(), out);
outputDir = path_1.default.join(process.cwd(), option.out);
return [4 /*yield*/, getLessFiles_1.getLessFiles(inputDir)];

@@ -29,24 +29,33 @@ case 1:

lessSource = _a.sent();
return [4 /*yield*/, Promise.all(lessSource.map(function (item) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var logPathIn, logPathOut;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
logPathIn = item.path.replace(process.cwd(), '');
item.path = item.path.replace(inputDir, outputDir).replace(/.less$/, '.css');
logPathOut = item.path.replace(process.cwd(), '');
console.log('log:', logPathIn, '->', logPathOut);
return [4 /*yield*/, fs_extra_1.default.outputFile(item.path, item.css)];
case 1:
_a.sent();
if (item.imports && item.imports.length > 0) {
console.log('imports:', item.imports);
}
return [2 /*return*/, item];
}
});
}); }))];
if (!option.combine) return [3 /*break*/, 4];
outputCssFile = path_1.default.join(process.cwd(), option.combine);
cssStr = lessSource.map(function (item) { return item.css; });
return [4 /*yield*/, fs_extra_1.default.outputFile(outputCssFile, cssStr.join(''))];
case 3:
_a.sent();
return [2 /*return*/];
console.log('log:', 'Output one file: ->', outputCssFile);
return [3 /*break*/, 6];
case 4: return [4 /*yield*/, Promise.all(lessSource.map(function (item) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var logPathIn, logPathOut;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
logPathIn = item.path.replace(process.cwd(), '');
item.path = item.path.replace(inputDir, outputDir).replace(/.less$/, '.css');
logPathOut = item.path.replace(process.cwd(), '');
console.log('log:', logPathIn, '->', logPathOut);
return [4 /*yield*/, fs_extra_1.default.outputFile(item.path, item.css)];
case 1:
_a.sent();
if (item.imports && item.imports.length > 0) {
console.log('imports:', item.imports);
}
return [2 /*return*/, item];
}
});
}); }))];
case 5:
_a.sent();
_a.label = 6;
case 6: return [2 /*return*/];
}

@@ -53,0 +62,0 @@ });

@@ -11,7 +11,9 @@ var program = require('commander');

.option('-d, --dir <dir-path>', 'Less file directory', 'src')
.option('-o, --out <dir-path>', 'Output directory.');
.option('-o, --out <dir-path>', 'Output directory.')
.option('-c, --combine <file-name>', 'Combine CSS files.');
program.on('--help', function () {
logs('\n Examples:');
logs();
logs(" $ compile-less -d src -o css");
logs(' $ compile-less -d src -o css');
logs(' $ compile-less -d src -o out --combine out/dist.css');
logs();

@@ -25,3 +27,6 @@ logs();

else {
compile(program.dir, program.out);
compile(program.dir, {
out: program.out,
combine: program.combine,
});
}
{
"name": "compile-less-cli",
"version": "1.0.0",
"version": "1.1.0",
"description": "compile less",

@@ -5,0 +5,0 @@ "bin": {

@@ -6,3 +6,3 @@ compile-less

## Install
### Install

@@ -13,2 +13,15 @@ ```bash

### Basic Usage
```js
const compileLess = require('compile-less-cli');
compileLess('src', {
out: 'out', // Output directory.
combine: 'dist/uiw.css', // Combine CSS files.
});
```
### Command Line
Command help:

@@ -22,6 +35,7 @@

Options:
-v, --version output the version number
-d, --dir <dir-path> Less file directory (default: "src")
-o, --out <dir-path> Output directory.
-h, --help output usage information
-v, --version output the version number
-d, --dir <dir-path> Less file directory (default: "src")
-o, --out <dir-path> Output directory.
-c, --combine <file-name> Combine CSS files.
-h, --help output usage information

@@ -33,3 +47,3 @@ Examples:

## Development
### Development

@@ -36,0 +50,0 @@ Listen for files compiled with TypeScript

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc