Skip to content

Commit

Permalink
feat: add build script for CSS export (resolve #3)
Browse files Browse the repository at this point in the history
  • Loading branch information
greatislander committed Jul 18, 2023
1 parent 329c347 commit 224ba95
Show file tree
Hide file tree
Showing 8 changed files with 619 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
.DS_Store
dist
main.css
!src/static/css/main.css
16 changes: 16 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.*.cjs
.*.js
.github
.gitignore
.husky
.npmignore
.nvmrc
*.config.js
bin
dist
src/_data
src/_includes
src/*.md
src/*.njk
src/static/*.njk
src/static/design-system
3 changes: 2 additions & 1 deletion .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
module.exports = {
"extends": "stylelint-config-fluid",
"ignoreFiles": ["dist/**/*.css"],
"ignoreFiles": ["dist/**/*.css", "./main.css"],
"rules": {
"custom-property-pattern": null,
"import-notation": "string",
"selector-class-pattern": null
}
};
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# Inclusive Design Guide Design System

To run the design system microsite in local development mode:

```bash
npm run dev
npm start
```

# Or
To build a static copy of the design system microsite, found at `./dist/`:

```bash
npm run build
```

To build the main CSS file, found at `./main.css`:

```bash
npm run dist
```
23 changes: 23 additions & 0 deletions bin/check-imports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* eslint-disable no-console */

const chalk = require("chalk");
const fs = require("fs");
const path = require("path");

fs.readFile("./src/static/css/main.css", "utf8", (error, data) => {
const filenames = fs.readdirSync("./src/static/css/")
.map(file => path.basename(file));


filenames.forEach(filename => {
if (filename !== "main.css") {
if (!data.includes(filename)) {
console.error(chalk.red(`Error: "${filename}" not imported.`));
process.exit(1);
}
}
});

console.log(chalk.green("Success! All files are imported."));
process.exit();
});
Loading

0 comments on commit 224ba95

Please sign in to comment.