+12
-4
@@ -89,3 +89,3 @@ const fs = require('fs'), | ||
| const {src, relativePath} = file; | ||
| const scssContent = replaceLess(src); | ||
| const scssContent = transformFileSync(src); | ||
| writeFile(src, scssContent, destinationPath, relativePath); | ||
@@ -105,4 +105,8 @@ }); | ||
| const replaceLess = file => { | ||
| const transformFileSync = (file) => { | ||
| let content = fs.readFileSync(file, 'utf8'); | ||
| return transformSync(content, file); | ||
| } | ||
| const transformSync = (content, file) => { | ||
| let transformedContent = content.replace(/\/less\//g, '/scss/') | ||
@@ -168,3 +172,3 @@ .replace(/\.less/g, '.scss') | ||
| transformedContent = '@use "sass:math";\n' + replaceAll(transformedContent, regexMathBuiltIn, (match, p1, index, input) => { | ||
| console.log(`${MESSAGE_PREFIX.WARNING} There is math built-in function "${colors.bold(p1)}" check if rewrite is correct.\nFile ${file}:${input.substring(0, index).split('\n').length + 1}`) | ||
| console.log(`${MESSAGE_PREFIX.WARNING} There is math built-in function "${colors.bold(p1)}" check if rewrite is correct.\nFile ${file || '""' }}:${input.substring(0, index).split('\n').length + 1}`) | ||
| return `math.${match}`; | ||
@@ -199,2 +203,6 @@ }); | ||
| module.exports = less2scss; | ||
| module.exports = { | ||
| less2scss, | ||
| transformFileSync, | ||
| transformSync | ||
| }; |
+9
-2
| { | ||
| "name": "less2scss", | ||
| "version": "1.9.1", | ||
| "version": "1.9.2", | ||
| "description": "This utility quickly converts all your less files to scss.", | ||
@@ -14,4 +14,8 @@ "main": "index.js", | ||
| }, | ||
| "files": [ | ||
| "bin", | ||
| "index.js" | ||
| ], | ||
| "scripts": { | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
| "test": "ava" | ||
| }, | ||
@@ -38,3 +42,6 @@ "repository": { | ||
| "string.prototype.replaceall": "^1.0.5" | ||
| }, | ||
| "devDependencies": { | ||
| "ava": "^5.1.0" | ||
| } | ||
| } |
| version: 2 | ||
| updates: | ||
| - package-ecosystem: npm | ||
| directory: "/" | ||
| schedule: | ||
| interval: daily | ||
| time: '04:00' | ||
| open-pull-requests-limit: 10 |
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v1 | ||
| - uses: actions/setup-node@v1 | ||
| with: | ||
| node-version: 10 | ||
| - run: npm install | ||
| - uses: JS-DevTools/npm-publish@v1 | ||
| with: | ||
| token: ${{ secrets.NPM_TOKEN }} |
Sorry, the diff of this file is not supported yet
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
168
4.35%0
-100%24492
-1.01%1
Infinity%5
-28.57%