gulp-dart-scss
Advanced tools
Comparing version 1.0.3 to 1.0.4
86
index.js
const through2 = require("through2"); | ||
const pluginError = require("plugin-error"); | ||
const dartSass = require("dart-sass"); | ||
const dartSass = require("sass"); | ||
const applySourceMap = require("vinyl-sourcemaps-apply"); | ||
@@ -8,51 +8,51 @@ const path = require("path"); | ||
module.exports = (options = {}) => { | ||
return through2.obj((file, encoding, callback) => { | ||
if (file.isNull()) { | ||
return callback(null, file); | ||
} | ||
return through2.obj((file, encoding, callback) => { | ||
if (file.isNull()) { | ||
return callback(null, file); | ||
} | ||
if (file.isStream()) { | ||
return callback( | ||
new pluginError("gulp-dart-scss", "Streaming not supported") | ||
); | ||
} | ||
if (file.isStream()) { | ||
return callback( | ||
new pluginError("gulp-dart-scss", "Streaming not supported") | ||
); | ||
} | ||
// Ignore _name.scss files | ||
if (path.basename(file.path).indexOf("_") === 0) { | ||
return callback(); | ||
} | ||
// Ignore _name.scss files | ||
if (path.basename(file.path).indexOf("_") === 0) { | ||
return callback(); | ||
} | ||
(async () => { | ||
try { | ||
options.sourceMap = file.sourceMap ? file.path : false; | ||
options.file = file.path || options.file; | ||
(async () => { | ||
try { | ||
options.sourceMap = file.sourceMap ? file.path : false; | ||
options.file = file.path || options.file; | ||
const result = await dartSass.renderSync(options); | ||
file.contents = Buffer.from(result.css); | ||
const result = await dartSass.renderSync(options); | ||
file.contents = Buffer.from(result.css); | ||
// Replace .scss with .css | ||
file.path = path.join( | ||
path.dirname(file.path), | ||
path.basename(file.path, path.extname(file.path)) + ".css" | ||
); | ||
// Replace .scss with .css | ||
file.path = path.join( | ||
path.dirname(file.path), | ||
path.basename(file.path, path.extname(file.path)) + ".css" | ||
); | ||
// Apply sourcemap if gulp-sourcemap is present | ||
if (result.map && file.sourceMap) { | ||
const map = JSON.parse(result.map); | ||
map.file = file.relative; | ||
map.sources = map.sources.map(source => | ||
path.relative(file.base, source) | ||
); | ||
applySourceMap(file, map); | ||
} | ||
// Apply sourcemap if gulp-sourcemap is present | ||
if (result.map && file.sourceMap) { | ||
const map = JSON.parse(result.map); | ||
map.file = file.relative; | ||
map.sources = map.sources.map(source => | ||
path.relative(file.base, source) | ||
); | ||
applySourceMap(file, map); | ||
} | ||
setImmediate(callback, null, file); | ||
} catch (error) { | ||
process.stderr.write( | ||
`${new pluginError("gulp-dart-scss", error.message).toString()} \r\n` | ||
); | ||
return callback(); | ||
} | ||
})(); | ||
}); | ||
setImmediate(callback, null, file); | ||
} catch (error) { | ||
process.stderr.write( | ||
`${new pluginError("gulp-dart-scss", error.message).toString()} \r\n` | ||
); | ||
return callback(); | ||
} | ||
})(); | ||
}); | ||
}; |
{ | ||
"name": "gulp-dart-scss", | ||
"version": "1.0.3", | ||
"description": "Gulp plugin to compile Sass using the Dart Sass compiler.", | ||
"author": "Kasper Hesthaven", | ||
"repository": "kasperhesthaven/gulp-dart-scss", | ||
"license": "MIT", | ||
"main": "index.js", | ||
"engines": { | ||
"node": ">=7" | ||
}, | ||
"keywords": [ | ||
"dartsass", | ||
"gulpplugin", | ||
"sass" | ||
], | ||
"dependencies": { | ||
"dart-sass": "^1.25.0", | ||
"plugin-error": "^1.0.1", | ||
"through2": "^3.0.1", | ||
"vinyl-sourcemaps-apply": "^0.2.1" | ||
} | ||
"name": "gulp-dart-scss", | ||
"version": "1.0.4", | ||
"description": "Gulp plugin to compile Sass using the Dart Sass compiler.", | ||
"author": "Kasper Hesthaven", | ||
"repository": "kasperhesthaven/gulp-dart-scss", | ||
"license": "MIT", | ||
"main": "index.js", | ||
"engines": { | ||
"node": ">=7" | ||
}, | ||
"keywords": [ | ||
"dartsass", | ||
"gulpplugin", | ||
"sass" | ||
], | ||
"dependencies": { | ||
"sass": "^1.26.3", | ||
"plugin-error": "^1.0.1", | ||
"through2": "^3.0.1", | ||
"vinyl-sourcemaps-apply": "^0.2.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3913
+ Addedsass@^1.26.3
+ Added@parcel/watcher@2.5.0(transitive)
+ Added@parcel/watcher-android-arm64@2.5.0(transitive)
+ Added@parcel/watcher-darwin-arm64@2.5.0(transitive)
+ Added@parcel/watcher-darwin-x64@2.5.0(transitive)
+ Added@parcel/watcher-freebsd-x64@2.5.0(transitive)
+ Added@parcel/watcher-linux-arm-glibc@2.5.0(transitive)
+ Added@parcel/watcher-linux-arm-musl@2.5.0(transitive)
+ Added@parcel/watcher-linux-arm64-glibc@2.5.0(transitive)
+ Added@parcel/watcher-linux-arm64-musl@2.5.0(transitive)
+ Added@parcel/watcher-linux-x64-glibc@2.5.0(transitive)
+ Added@parcel/watcher-linux-x64-musl@2.5.0(transitive)
+ Added@parcel/watcher-win32-arm64@2.5.0(transitive)
+ Added@parcel/watcher-win32-ia32@2.5.0(transitive)
+ Added@parcel/watcher-win32-x64@2.5.0(transitive)
+ Addedchokidar@4.0.1(transitive)
+ Addeddetect-libc@1.0.3(transitive)
+ Addedimmutable@5.0.3(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addednode-addon-api@7.1.1(transitive)
+ Addedreaddirp@4.0.2(transitive)
+ Addedsass@1.81.0(transitive)
+ Addedsource-map-js@1.2.1(transitive)
- Removeddart-sass@^1.25.0
- Removedanymatch@3.1.3(transitive)
- Removedbinary-extensions@2.3.0(transitive)
- Removedchokidar@3.6.0(transitive)
- Removeddart-sass@1.25.0(transitive)
- Removedfsevents@2.3.3(transitive)
- Removedglob-parent@5.1.2(transitive)
- Removedis-binary-path@2.1.0(transitive)
- Removednormalize-path@3.0.0(transitive)
- Removedreaddirp@3.6.0(transitive)