Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"extends": "@18f/identity-stylelint-config"
"extends": "@18f/identity-stylelint-config",
"ignoreFiles": "**/fixtures/**/*"
}
6 changes: 6 additions & 0 deletions app/javascript/packages/build-sass/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Unreleased

### Improvements

- Adds support for ".scss" file extension, as an alternative to the current ".css.scss" support. In both cases, the output files use the basename with a ".css" extension.

## 1.2.0

### Improvements
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/packages/build-sass/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Default behavior includes:
Invoke the included `build-sass` executable with the source files and any relevant command flags.

```
npx build-sass path/to/sass/*.css.scss --out-dir=build
npx build-sass path/to/sass/*.scss --out-dir=build
```

Flags:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
styles.css
Empty file.
2 changes: 1 addition & 1 deletion app/javascript/packages/build-sass/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function buildFile(file, options) {
quietDeps: true,
});

let outFile = basename(file, '.scss');
let outFile = `${basename(basename(file, '.css.scss'), '.scss')}.css`;

const lightningResult = lightningTransform({
filename: outFile,
Expand Down
26 changes: 26 additions & 0 deletions app/javascript/packages/build-sass/index.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { stat } from 'node:fs/promises';
import { buildFile } from './index.js';

const cwd = dirname(fileURLToPath(import.meta.url));

describe('buildFile', () => {
context('with .css.scss file extension', () => {
it('writes a file with the same basename and a .css extension', async () => {
const fixtureDir = join(cwd, 'fixtures/css-scss-extension');
await buildFile(join(fixtureDir, 'styles.css.scss'), { outDir: fixtureDir });

await stat(join(fixtureDir, 'styles.css'));
});
});

context('with .scss file extension', () => {
it('writes a file with the same basename and a .css extension', async () => {
const fixtureDir = join(cwd, 'fixtures/scss-extension');
await buildFile(join(fixtureDir, 'styles.scss'), { outDir: fixtureDir });

await stat(join(fixtureDir, 'styles.css'));
});
});
});