Skip to content

Instantly share code, notes, and snippets.

@terrierscript
Last active October 21, 2018 15:03
Show Gist options
  • Select an option

  • Save terrierscript/27b760e4031c384580a9a65c275961ca to your computer and use it in GitHub Desktop.

Select an option

Save terrierscript/27b760e4031c384580a9a65c275961ca to your computer and use it in GitHub Desktop.
ここがすごいぞ! stylelint! ref: https://qiita.com/terrierscript/items/ff4f6972c988afbec3a8
// ruleはpluginの一部として記載する
module.exports = stylelint.createPlugin(ruleName, function(expectationKeyword, optionsObject) {
return function(root, result) {
// PostCSSのRoot Nodeが取得されるので、これを利用してruleを書いていく
}
})
{
"plugins": [
"../some-rule-set.js"
],
"rules": {
"block-no-empty": null,
"color-no-invalid-hex": true,
},
}
$ npm install stylelint stylelint-config-standard -D
{
"extends": "stylelint-config-standard"
}
:
var postcssScss = require('postcss-scss')
var stylelint = require('stylelint')
:
gulp.task('scss-lint', function () {
gulp.src("path/to/scss")
.pipe(postcss([
stylelint(), // これを追加
postcssReporter({clearMessages: true}), // こっちも必要
], {syntax: postcssScss}))
.pipe(gulp.dest('./web/css'));
});
{
"color-hex-case": [ "lower", {
"message": "色はhexで統一しましょう"
} ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment