Skip to content

Commit 3d7e46f

Browse files
committed
build: add .import sass files (#21869)
(cherry picked from commit 4ae90cc)
1 parent c3abc14 commit 3d7e46f

File tree

132 files changed

+513
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+513
-9
lines changed

shim-scss-imports.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env node
2+
3+
const path = require('path');
4+
const proc = require('child_process');
5+
const fs = require('fs');
6+
7+
const findResult = proc.spawnSync('find', ['.', '-iname', '"_*.scss"'], {
8+
cwd: __dirname,
9+
shell: true,
10+
env: process.env,
11+
}).stdout.toString();
12+
13+
const sassFiles = findResult.trim().split('\n');
14+
for (const f of sassFiles) {
15+
const originalFileContent = fs.readFileSync(f, 'utf8');
16+
17+
const originalFileName = path.basename(f);
18+
const originalDirectory = path.dirname(f);
19+
20+
let importFileContent =
21+
`@forward '${originalFileName.replace(/^_/, '').replace('.scss', '')}';\n`;
22+
const originalImportLines = originalFileContent.matchAll(/@import '(.+)';/g);
23+
for (const match of originalImportLines) {
24+
const importPath = match[1];
25+
if (importPath.includes('@material')) continue;
26+
if (importPath.includes('private')) continue;
27+
28+
importFileContent += `@forward '${importPath}';\n`;
29+
}
30+
31+
const importFileName = originalFileName.replace('.scss', '.import.scss');
32+
const importFilePath = path.join(originalDirectory, importFileName);
33+
fs.writeFileSync(importFilePath, importFileContent, 'utf8');
34+
}

src/cdk/a11y/_a11y.import.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@forward 'a11y';

src/cdk/overlay/_overlay.import.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@forward 'overlay';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@forward 'text-field';
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@forward 'column-resize';
2+
@forward '../../material/core/style/variables';
3+
@forward '../../material/core/style/vendor-prefixes';
4+
@forward '../../material/core/theming/palette';
5+
@forward '../../material/core/theming/theming';
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@forward 'autocomplete-theme';
2+
@forward '../mdc-helpers/mdc-helpers';
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@forward 'button-base';
2+
@forward '../../material/core/style/layout-common';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@forward 'button-theme';
2+
@forward '../../material/core/ripple/ripple';
3+
@forward '../mdc-helpers/mdc-helpers';
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@forward 'card-theme';
2+
@forward '../mdc-helpers/mdc-helpers';
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@forward 'checkbox-theme';
2+
@forward '../mdc-helpers/mdc-helpers';

0 commit comments

Comments
 (0)