Skip to content
This repository was archived by the owner on Mar 30, 2023. It is now read-only.

Commit 038f46a

Browse files
mdoXhmikosR
andauthored
Adds Stylelint (#18)
* Adds Stylelint - New npm script, css-lint - Pulls in Bootstrap's config - Replaces named color with BS variable - Updates readme with new script, also adds links to other tools * Add css-lint script in `npm test` * Mention Stylelint in the readme, add test to script table * Mention npm test there too * Explain stylelintignore and stylelintrc files Co-authored-by: XhmikosR <xhmikosr@gmail.com>
1 parent e7296d0 commit 038f46a

File tree

5 files changed

+2310
-170
lines changed

5 files changed

+2310
-170
lines changed

.stylelintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/*.min.css
2+
**/dist/
3+
node_modules

.stylelintrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": [
3+
"stylelint-config-twbs-bootstrap/scss"
4+
]
5+
}

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,18 @@ Open <http://localhost:3000> to see the page in action.
5555

5656
## Scripts
5757

58-
The following npm scripts are available to you in this starter repo. With the exception of `npm start`, the remaining scripts can be run from your command line with `npm run scriptName`.
58+
The following npm scripts are available to you in this starter repo. With the exception of `npm start` and `npm test`, the remaining scripts can be run from your command line with `npm run scriptName`.
5959

6060
| Script | Description |
6161
| --- | --- |
6262
| `server` | Starts a local server (<http://localhost:3000>) for development |
6363
| `watch` | Automatically recompiles CSS as it watches the `scss` directory for changes |
6464
| `css` | Runs `css-compile` and `css-prefix` |
6565
| `css-compile` | Compiles source Sass into CSS |
66-
| `css-prefix` | Runs Autoprefixer on the compiled CSS |
67-
| `css-purge` | Runs PurgeCSS to remove CSS that is unused by `index.html` |
66+
| `css-lint` | Runs [Stylelint](https://stylelint.io) against source Sass for code quality |
67+
| `css-prefix` | Runs [Autoprefixer](https://github.com/postcss/autoprefixer) on the compiled CSS |
68+
| `css-purge` | Runs [PurgeCSS](https://purgecss.com) to remove CSS that is unused by `index.html` |
69+
| `test` | Runs `css-lint` and `css`, in sequential order |
6870

6971
## Advanced usage
7072

@@ -110,6 +112,12 @@ When your repository is generated, you won't see anything in the Actions tab unt
110112

111113
[Learn more about GitHub Actions](https://github.com/features/actions), [read the Actions docs](https://help.github.com/en/actions), or [browse the Actions Marketplace](https://github.com/marketplace/actions).
112114

115+
### Stylelint
116+
117+
Stylelint is included, as is Bootstrap's default Stylelint config, [stylelint-config-twbs-bootstrap](https://github.com/twbs/stylelint-config-twbs-bootstrap). This is the same linter configuration we use in the main Bootstrap project. It's run via the `npm test` command, which is invoked in our `ci.yml` Actions workflow file.
118+
119+
At the root of the repo, `.stylelintignore` is used to list files that we ignore when linting and `.stylelintrc` is where we tell Stylelint to use the Bootstrap config. The former is recommended based on your specific needs, while the latter is required.
120+
113121
## Copyright
114122

115123
&copy; @mdo 2020-2021 and licensed MIT.

0 commit comments

Comments
 (0)