Closed s10wen closed 8 years ago
@s10wen Where did you install stylfmt? If you installed as -g
option, it might not work well.
OK, I will implement --stylelintPath
option to set the path of stylelint configuration file.
Thanks.
@morishitter yeah I installed it globally for now. Ideally I'd like to be local as part of a repo.
Awesome, cheers! Let me know if you want me to test a branch.
@s10wen Just released v3.5.0 that includes --config
option to specify the path of stylelint configration file. Please update and confirm it :)
@morishitter I'm on 3.5.0 and created a 'test.css':
.test {
color: #FFF;
}
and a .stylelintrc
:
"rules": {
"color-hex-case": 'lower'
}
I then did stylefmt test.css -c .stylelintrc
, but I get:
.test {
color: #fff;
}
I would expect it to look at the config file and update the hex, but not the indentation. Any ideas?
@s10wen It formatted the string to lowercase (#FFF
-> #fff
). It seems correct. 🤔
But it also did the indentation that I hadn't set.
I also tried the example in the README.md
:
// mixin for clearfix
@mixin clearfix () { &:before,
&:after {
content:" ";
display : table; }
&:after {clear: both;}
}.class
{
padding:10px;@include clearfix();}
.base { color: red; } // placeholder
%base
{
padding: 12px
}
.foo{
@extend .base;}
.bar
{ @extend %base;
}
which running stylefmt test.css -c .stylelintrc
(my config only contains color-hex-case
) yielded:
// mixin for clearfix
@mixin clearfix() {
&:before,
&:after {
content: " ";
display: table;
}
&:after {
clear: both;
}
}
.class {
padding: 10px;
@include clearfix();
}
.base {
color: red;
}
// placeholder
%base {
padding: 12px;
}
.foo {
@extend .base;
}
.bar {
@extend %base;
}
So, this also moved the comments as well as indentation, making me think it's not looking at the config and taking effect from what is just in the config.
Any ideas please?
@s10wen Oh, I see. stylefmt formats string according to a stylelint configuration file, but if there are no rules for formatting code parts (e.g. block-opening-brace-space-after
, indentation
), we can get default formatting rules. So, you got 2 spaces indentation after running stylefmt.
May I ask if you understand what I mean? So sorry, I"m not good at English.
@morishitter ah I understand, thanks. Is there a way to set it so it doesn't pick up the default rules?
@s10wen This problem seems the same as https://github.com/morishitter/stylefmt/issues/86 .
@morishitter yep! Something like that would be great :)
Wondering if via the https://github.com/morishitter/stylefmt#in-command-line it's possible to pass a custom file like
.stylefmt
with your own https://github.com/morishitter/stylefmt#basic rules?Or, as I'm using
.stylelintrc
if it's possible to pass the stylelintrc path for it to use?