🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

less2scss

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

less2scss - npm Package Compare versions

Comparing version
1.3.0
to
1.4.0
+27
-11
index.js

@@ -8,2 +8,3 @@ const fs = require('fs'),

replaceAll = require('string.prototype.replaceall');
const ignore = require("ignore");

@@ -17,11 +18,15 @@ const MESSAGE_PREFIX = {

const less2scss = (src, dst, recursive) => {
const less2scss = (src, dst, recursive, exclude) => {
if (src) {
console.info(`${MESSAGE_PREFIX.INFO} ${colors.yellow(`Recursive option is ${colors.yellow.bold(recursive ? 'ON' : 'OFF')}`)}`);
const pathList = src.split(','),
excludedPaths = exclude && exclude.length > 0 ? exclude.split(',') : [];
const pathList = src.split(',');
let lessFiles = [],
destinationPath = dst;
console.info(`${MESSAGE_PREFIX.INFO} ${colors.yellow(`Recursive option is ${colors.yellow.bold(recursive ? 'ON' : 'OFF')}`)}`);
console.info(`${MESSAGE_PREFIX.INFO} ${colors.yellow(`Excluded paths: ${excludedPaths.length}`)}`);
pathList.forEach(beginPath => {

@@ -36,12 +41,23 @@

beginPath = path.resolve(beginPath);
let curPathType = fs.lstatSync(beginPath);
if (curPathType.isDirectory()) {
lessFiles = [...lessFiles, ...glob
.sync(`${beginPath}/${recursive ? '**/*' : '*'}.less`)
.map(lessFile => ({
src: lessFile,
relativePath: path.relative(beginPath, lessFile)
}))];
let currLessFiles = ignore()
.add(excludedPaths).filter(
glob.sync(`${beginPath}/${recursive ? '**/*' : '*'}.less`, {
mark: true,
onlyFiles: true
}).map(
p => path.relative(beginPath, p)
)
).map(
lessFile => ({
src: path.join(beginPath, lessFile),
relativePath: lessFile
})
)
lessFiles = [...lessFiles, ...currLessFiles];
}

@@ -156,3 +172,3 @@

const newPath = relativePath !== '' ? path.dirname( destinationPath+'/'+relativePath ) : destinationPath;
const newPath = relativePath !== '' ? path.dirname(destinationPath + '/' + relativePath) : destinationPath;

@@ -159,0 +175,0 @@ if (!fs.existsSync(newPath)) {

{
"name": "less2scss",
"version": "1.3.0",
"version": "1.4.0",
"description": "This utility quickly converts all your less files to scss.",

@@ -27,3 +27,3 @@ "main": "index.js",

"bugs": {
"url": "https://github.com/debbba/less2scss/issues"
"url": "https://github.com/debba/less2scss/issues"
},

@@ -33,4 +33,5 @@ "homepage": "https://www.debbaweb.it",

"colors": "^1.4.0",
"commander": "^7.2.0",
"commander": "^8.1.0",
"glob": "^7.1.7",
"ignore": "^5.1.8",
"mkdirp": "^1.0.4",

@@ -37,0 +38,0 @@ "string.prototype.replaceall": "^1.0.5"

@@ -29,3 +29,2 @@ [![NPM](https://nodei.co/npm/less2scss.png)](https://nodei.co/npm/less2scss.png/)

```

@@ -37,7 +36,8 @@ Usage: less2scss [options]

Options:
-V, --version output the version number
-s, --src <sourcePaths> source paths comma separated
-d, --dst <dstPath> destination path
-r, --recursive allow to recursively walk directories (default: false)
-h, --help display help for command
-V, --version output the version number
-s, --src <sourcePaths> comma separated source paths
-d, --dst <dstPath> destination path
-e, --exclude <excludePaths> comma separated exclude paths
-r, --recursive allow to recursively walk directories (default: false)
-h, --help display help for command
```

@@ -53,5 +53,28 @@

| Destination path for converted SCSS files (if provided). If not provided, it will be the same directory | `-d` | `--dst` | No | Same directory of files provided |
| Comma separated exclude paths | `-e` | `--exclude` | No | - |
| Allow to recursively walk directories | `-r` | `--recursive` | No | false |
**Note:**
For excluding files and path we use [ignore](https://www.npmjs.com/package/ignore) package.
_`ignore` is a manager, filter and parser which implemented in pure JavaScript according to the .gitignore spec 2.22.1.
**All paths provided must be relative to the source path**
Examples
--------
#### Convert LESS files inside a folder excluding `node_modules` and `vendor` subfolders.
```bash
$ less2scss -s ./less_folder -d ./scss_folder -r -e 'node_modules,vendor'
```
#### Convert LESS files inside a folder excluding all subfolders whose name begins with `test`.
```bash
$ less2scss -s ./less_folder -d ./scss_folder -r -e 'node_modules,vendor'
```
Notice

@@ -58,0 +81,0 @@ --------

Sorry, the diff of this file is not supported yet