From 0d66e664b9f0a6e3463795f5e7fcd9c070e1e5c7 Mon Sep 17 00:00:00 2001 From: Vladimir Shapovalov Date: Sun, 20 Feb 2022 20:32:16 +0700 Subject: [PATCH 1/5] update dependencies, fix css-sass.js --- .gitignore | 3 ++- package.json | 10 +++++----- techs/css-sass.js | 12 +++++------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 1b290e6..2d140f8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea/ node_modules/ -.DS_Store \ No newline at end of file +.DS_Store +package-lock.json \ No newline at end of file diff --git a/package.json b/package.json index 4920d5e..79d6221 100644 --- a/package.json +++ b/package.json @@ -28,11 +28,11 @@ "github-username": "ixax" } ], - "dependencies" : { - "enb": "0.15.0", - "node-sass": "3.3.3", - "vow": "0.4.9", - "inherit": "2.2.2" + "dependencies": { + "enb": "^1.5.1", + "sass": "^1.49.8", + "vow": "^0.4.20", + "enb-css-preprocessor": "^1.0.0" }, "engines": { "node": ">=0.10" diff --git a/techs/css-sass.js b/techs/css-sass.js index ad9d4fd..8e1bf2a 100644 --- a/techs/css-sass.js +++ b/techs/css-sass.js @@ -1,7 +1,6 @@ -var sass = require('node-sass'); +var sass = require('sass'); var Vow = require('vow'); -var inherit = require('inherit'); -var CssPreprocessor = require('enb/lib/preprocess/css-preprocessor'); +var CssPreprocessor = require('enb-css-preprocessor'); var vowFs = require('enb/lib/fs/async-fs'); var path = require('path'); var util = require('util'); @@ -17,10 +16,10 @@ module.exports = require('enb/lib/build-flow').create() .builder(function (sourceFiles) { var _this = this; var deferred = Vow.defer(); - var sassSettings = inherit({ + var sassSettings = { includePaths: [], data: '' - }, this._sass); + }; var errorLogging = { enabled: true, offsetLines: 5 @@ -66,8 +65,7 @@ module.exports = require('enb/lib/build-flow').create() deferred.resolve(cssResult); } catch (ex) { ex = ex instanceof Error ? ex : JSON.parse(ex); - - var lines = sassSettings.data.split('\n'); + var lines = sassSettings.data.split('\n') || []; var errorCtx = lines.slice(ex.line - errorLogging.offsetLines, ex.line).concat( '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^', lines.slice(ex.line + 1, ex.line + errorLogging.offsetLines + 1) From 4e0e8ae6138efebcb1a6f63e2d285e3396ee6ff9 Mon Sep 17 00:00:00 2001 From: Vladimir Shapovalov Date: Sun, 20 Feb 2022 21:00:52 +0700 Subject: [PATCH 2/5] update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9acbaa0..4ba07b4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# [enb](https://github.com/enb-make/enb)-sass [![npm version](https://img.shields.io/badge/npm-v1.0.1-blue.svg)](https://www.npmjs.com/package/enb-sass) [![node-sass supports version](https://img.shields.io/badge/node--sass-3.2.0-orange.svg)](https://github.com/sass/node-sass/tree/v2) [![Build Status](https://travis-ci.org/enb-make/enb-sass.svg?branch=master)](https://travis-ci.org/enb-make/enb-sass) [![Dependency Status](https://david-dm.org/enb-make/enb-sass.svg)](https://david-dm.org/enb-make/enb-sass) +# [enb](https://github.com/enb-make/enb)-sass [![npm version](https://img.shields.io/badge/npm-v1.0.1-blue.svg)](https://www.npmjs.com/package/enb-sass) [![node-sass supports version](https://img.shields.io/badge/sass-1.49.8-orange.svg)](https://github.com/sass/sass/) [![Build Status](https://travis-ci.org/enb-make/enb-sass.svg?branch=master)](https://travis-ci.org/enb-make/enb-sass) [![Dependency Status](https://david-dm.org/enb-make/enb-sass.svg)](https://david-dm.org/enb-make/enb-sass) Provides the `node-sass` features for project-builder `enb` (https://github.com/enb-make/enb). From b946c97d970da128f69fc4ce26dadc71b71ff62b Mon Sep 17 00:00:00 2001 From: Vladimir Shapovalov Date: Sat, 26 Feb 2022 13:08:48 +0700 Subject: [PATCH 3/5] fix sassSettings, refactoring --- package.json | 8 ++++---- techs/css-sass.js | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 79d6221..bd39545 100644 --- a/package.json +++ b/package.json @@ -29,10 +29,10 @@ } ], "dependencies": { - "enb": "^1.5.1", - "sass": "^1.49.8", - "vow": "^0.4.20", - "enb-css-preprocessor": "^1.0.0" + "enb": "1.5.1", + "enb-css-preprocessor": "1.0.0", + "sass": "1.49.8", + "vow": "0.4.20" }, "engines": { "node": ">=0.10" diff --git a/techs/css-sass.js b/techs/css-sass.js index 8e1bf2a..b11d548 100644 --- a/techs/css-sass.js +++ b/techs/css-sass.js @@ -11,14 +11,15 @@ Logger = new Logger(); module.exports = require('enb/lib/build-flow').create() .name('enb-sass') .target('target', '?.css') - .defineOption('sass', {}) // https://github.com/sass/node-sass#options + .defineOption('sass', {}) // https://sass-lang.com/documentation/js-api/interfaces/LegacySharedOptions .useFileList(['css', 'scss']) .builder(function (sourceFiles) { var _this = this; var deferred = Vow.defer(); var sassSettings = { includePaths: [], - data: '' + data: '', + ..._this._options.sass }; var errorLogging = { enabled: true, @@ -65,7 +66,7 @@ module.exports = require('enb/lib/build-flow').create() deferred.resolve(cssResult); } catch (ex) { ex = ex instanceof Error ? ex : JSON.parse(ex); - var lines = sassSettings.data.split('\n') || []; + var lines = sassSettings.data.split('\n'); var errorCtx = lines.slice(ex.line - errorLogging.offsetLines, ex.line).concat( '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^', lines.slice(ex.line + 1, ex.line + errorLogging.offsetLines + 1) From c0508cf5b060edfa940ad0fa472775dea9724ec6 Mon Sep 17 00:00:00 2001 From: Vladimir Shapovalov Date: Sun, 27 Feb 2022 15:33:34 +0700 Subject: [PATCH 4/5] update README.md --- README.md | 12 +++++------- techs/css-sass.js | 7 +++++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 4ba07b4..e9b9fc3 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ npm install enb-sass --save * *String* **target** contains target file name. Default: `?.css` * *String* **filesTarget** contains file masks, according to which a list of source files is created. Default: `?.files`. * *Array* **sourceSuffixes** Files suffixes that will be used. Default: `css` -* *Object* **sass** `node-sass` options. Read more: https://github.com/sass/node-sass#options. Default: default `node-sass` options. +* *Object* **sass** `sass` options. Read more: [SharedOptions](https://sass-lang.com/documentation/js-api/interfaces/LegacySharedOptions), [FileOptions](https://sass-lang.com/documentation/js-api/interfaces/LegacyFileOptions), [StringOptions](https://sass-lang.com/documentation/js-api/interfaces/LegacyStringOptions). Default: default `sass` options. ## Usage @@ -39,7 +39,7 @@ nodeConfig.addTech([ ]); ``` -#### Use `node-sass` [compression](https://github.com/sass/node-sass#outputstyle) and [debug mode](https://github.com/sass/node-sass#sourcecomments) +#### Use `sass` [compression](https://sass-lang.com/documentation/js-api/interfaces/LegacySharedOptions) ```javascript nodeConfig.addTech([ @@ -48,14 +48,13 @@ nodeConfig.addTech([ target: '?.css', sourceSuffixes: ['scss'], sass: { - outputStyle: 'compressed', - sourceComments: true + outputStyle: 'compressed' } } ]); ``` -#### Collecting ie and ie8 css/scss files with `node-sass` [compression](https://github.com/sass/node-sass#outputstyle) and [debug mode](https://github.com/sass/node-sass#sourcecomments) +#### Collecting ie and ie8 css/scss files with `sass` [compression](https://sass-lang.com/documentation/js-api/interfaces/LegacySharedOptions) ```javascript nodeConfig.addTech([ @@ -64,8 +63,7 @@ nodeConfig.addTech([ target: '?.css', sourceSuffixes: ['css', 'scss', 'ie.css', 'ie.scss', 'ie8.css', 'ie8.scss'], sass: { - outputStyle: 'compressed', - sourceComments: true + outputStyle: 'compressed' } } ]); diff --git a/techs/css-sass.js b/techs/css-sass.js index b11d548..3337b03 100644 --- a/techs/css-sass.js +++ b/techs/css-sass.js @@ -11,14 +11,17 @@ Logger = new Logger(); module.exports = require('enb/lib/build-flow').create() .name('enb-sass') .target('target', '?.css') - .defineOption('sass', {}) // https://sass-lang.com/documentation/js-api/interfaces/LegacySharedOptions + // https://sass-lang.com/documentation/js-api/interfaces/LegacySharedOptions + // https://sass-lang.com/documentation/js-api/interfaces/LegacyFileOptions + // https://sass-lang.com/documentation/js-api/interfaces/LegacyStringOptions + .defineOption('sass', {}) .useFileList(['css', 'scss']) .builder(function (sourceFiles) { var _this = this; var deferred = Vow.defer(); var sassSettings = { includePaths: [], - data: '', + data: '', ..._this._options.sass }; var errorLogging = { From 56b760daf71c1ccac875d92e48ff601448d0e0c9 Mon Sep 17 00:00:00 2001 From: Vladimir Shapovalov Date: Sun, 27 Feb 2022 15:36:28 +0700 Subject: [PATCH 5/5] update compression option link --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e9b9fc3..5cb9848 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ nodeConfig.addTech([ ]); ``` -#### Use `sass` [compression](https://sass-lang.com/documentation/js-api/interfaces/LegacySharedOptions) +#### Use `sass` [compression](https://sass-lang.com/documentation/js-api/interfaces/LegacySharedOptions#outputStyle) ```javascript nodeConfig.addTech([ @@ -54,7 +54,7 @@ nodeConfig.addTech([ ]); ``` -#### Collecting ie and ie8 css/scss files with `sass` [compression](https://sass-lang.com/documentation/js-api/interfaces/LegacySharedOptions) +#### Collecting ie and ie8 css/scss files with `sass` [compression](https://sass-lang.com/documentation/js-api/interfaces/LegacySharedOptions#outputStyle) ```javascript nodeConfig.addTech([