-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
7e4dad6
commit dae9586
Showing
5 changed files
with
37 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
|
||
const basePath = path.normalize(`${__dirname}/../src/components/`); | ||
|
||
async function isCalciteComponent(entry): Promise<boolean> { | ||
if (!entry.isDirectory()) { | ||
return false; | ||
} | ||
const files = await fs.promises.readdir(path.join(basePath, entry.name)); | ||
return files?.includes(`${entry.name}.tsx`); | ||
} | ||
|
||
(async function () { | ||
const stylePath = path.normalize(`${__dirname}/../src/assets/styles/_hydration.scss`); | ||
const components = await fs.promises.readdir(basePath, { withFileTypes: true }); | ||
const selectors = components.filter(isCalciteComponent).map(({ name }) => `calcite-${name}:not([calcite-hydrated])`); | ||
const fileContents = `// generated by support/hydrationStyles.ts | ||
${selectors.join(",\n")} { | ||
visibility: hidden; | ||
pointer-events: none; | ||
}`; | ||
await fs.promises.writeFile(stylePath, fileContents); | ||
process.exit(0); | ||
})(); |