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

Commit

Permalink
Adds Stylelint (#18)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
mdo and XhmikosR authored Jan 8, 2021
1 parent e7296d0 commit 038f46a
Show file tree
Hide file tree
Showing 5 changed files with 2,310 additions and 170 deletions.
3 changes: 3 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/*.min.css
**/dist/
node_modules
5 changes: 5 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"stylelint-config-twbs-bootstrap/scss"
]
}
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,18 @@ Open <http://localhost:3000> to see the page in action.

## Scripts

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`.
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`.

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

## Advanced usage

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

[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).

### Stylelint

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.

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.

## Copyright

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

0 comments on commit 038f46a

Please sign in to comment.