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

Add stylelint to HMR #10

Open
wturnerharris opened this issue Oct 9, 2018 · 0 comments
Open

Add stylelint to HMR #10

wturnerharris opened this issue Oct 9, 2018 · 0 comments

Comments

@wturnerharris
Copy link
Member

Barrel WordPress will include stylelint in an upcoming release.

Since adding this to the local webpack.config.js has no effect on HMR, we need to add the following to the webpack.js routine:

const StyleLintPlugin = require('stylelint-webpack-plugin')
...
  preparePlugins () {
...
      ...(this.watching && config.get('hmr') ? [
        new webpack.HotModuleReplacementPlugin()
      ]: []),
      new StyleLintPlugin({
        configFile: path.resolve(config.get('cwd'), '.stylelintrc'),
        files: '(src/css/|modules/)**/*.css',
        syntax: 'scss',
        failOnError: false,
        quiet: false
      }),  
      new webpack.NoEmitOnErrorsPlugin(),
    ]
  }

These are the deps required:

"stylelint": "^9.6.0",
"stylelint-config-standard": "^18.2.0",
"stylelint-webpack-plugin": "^0.10.5",
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant