@18f/identity-build-sass
Advanced tools
Comparing version 1.0.0 to 1.1.0
11
cli.js
@@ -8,2 +8,3 @@ #!/usr/bin/env node | ||
import { buildFile } from './index.js'; | ||
import getErrorSassStackPaths from './get-error-sass-stack-paths.js'; | ||
@@ -23,5 +24,8 @@ /** @typedef {import('sass-embedded').Options<'sync'>} SyncSassOptions */ | ||
const outDir = flags.find((flag) => flag.startsWith('--out-dir='))?.slice(10); | ||
const loadPaths = flags | ||
.filter((flag) => flag.startsWith('--load-path=')) | ||
.map((flag) => flag.slice(12)); | ||
/** @type {BuildOptions & SyncSassOptions} */ | ||
const options = { outDir, optimize: isProduction }; | ||
const options = { outDir, loadPaths, optimize: isProduction }; | ||
@@ -67,5 +71,4 @@ /** | ||
if (isWatching && isSassException(error) && error.span.url) { | ||
const exceptionPath = fileURLToPath(error.span.url); | ||
watchOnce(exceptionPath, () => build(files)); | ||
if (isWatching && isSassException(error)) { | ||
watchOnce(getErrorSassStackPaths(error.sassStack), () => build(files)); | ||
} else { | ||
@@ -72,0 +75,0 @@ throw error; |
@@ -30,7 +30,7 @@ import { basename, join } from 'path'; | ||
export async function buildFile(file, options) { | ||
const { outDir, optimize, ...sassOptions } = options; | ||
const { outDir, optimize, loadPaths = [], ...sassOptions } = options; | ||
const sassResult = sass.compile(file, { | ||
style: optimize ? 'compressed' : 'expanded', | ||
...sassOptions, | ||
loadPaths: ['node_modules'], | ||
loadPaths: ['node_modules', ...loadPaths], | ||
quietDeps: true, | ||
@@ -37,0 +37,0 @@ }); |
{ | ||
"name": "@18f/identity-build-sass", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"private": false, | ||
@@ -17,3 +17,4 @@ "description": "Stylesheet compilation utility with reasonable defaults and fast performance.", | ||
"index.js", | ||
"cli.js" | ||
"cli.js", | ||
"get-error-sass-stack-paths.js" | ||
], | ||
@@ -26,3 +27,3 @@ "license": "CC0-1.0", | ||
"dependencies": { | ||
"browserslist": "^4.21.4", | ||
"browserslist": "^4.21.5", | ||
"chokidar": "^3.5.3", | ||
@@ -29,0 +30,0 @@ "lightningcss": "^1.16.1", |
@@ -25,3 +25,3 @@ # `@18f/identity-build-sass` | ||
``` | ||
npx build-sass path/to/sass/*.css.scss --out-dir=build | ||
npx build-sass path/to/sass/*.css.scss --out-dir=build --load-path=node_modules/@uswds/uswds/packages | ||
``` | ||
@@ -33,2 +33,3 @@ | ||
- `--watch`: Run in watch mode, recompiling files on change | ||
- `--load-path`: Include additional path in Sass path resolution | ||
@@ -35,0 +36,0 @@ ### API |
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
9351
6
144
56
Updatedbrowserslist@^4.21.5