Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KSS Modifiers Section #2

Open
cmalven opened this issue Jan 23, 2013 · 7 comments
Open

KSS Modifiers Section #2

cmalven opened this issue Jan 23, 2013 · 7 comments

Comments

@cmalven
Copy link

cmalven commented Jan 23, 2013

We're attempting to get nkss up-and-running on a project and we're running into some issues where standard KSS syntax doesn't seem to work and it's unclear from your documentation whether it should work or not.

One example is for KSS Modifiers, typically used as such:

// :hover             - Subtle hover highlight.
// .stars-given       - A highlight indicating you've already given a star.
// .stars-given:hover - Subtle hover highlight on top of stars-given styling.
// .disabled          - Dims the button to indicate it cannot be used.

An attempt to do this with nkss results in this:

screenshot-01

Obviously not what we're looking for. Should this work? We're using the following documentation to create this:

/*
## Headings
Should typically be used via `@extend .heading-a`

.heading-a          - Another Heading
.heading-b          - Another Heading
.heading-c          - Another Heading

Styleguide 1.1
*/
.heading-a {
  ...
}

...
@rstacruz
Copy link
Member

How does your HTML/HAML look like?

@rstacruz
Copy link
Member

Try this. (Notice the absence of dots before heading-a et al):

/*
... (snip) ...
heading-a          - Another Heading
heading-b          - Another Heading
heading-c          - Another Heading

Styleguide 1.1
*/
.heading-a { ... }
.heading-b { ... }
.heading-c { ... }

...then try this for your markup. The param passed onto the KSS block (mod) is the names of the variants, which in your case is heading-a, heading-b and heading-c.

= kss_block '1.1' do |mod|
  %div{class: mod}
    This is a heading

@blahutka
Copy link

I had to modify _block.html.haml line:32, this is originaly from kss gem

%div{style: inner_style}= html.sub('$modifier_class', " #{modifier.class_name}").html_safe

@vgdub
Copy link

vgdub commented Mar 19, 2013

@rstacruz that worked perfect, thanks! Maybe something worth adding to the documentation?

@rstacruz
Copy link
Member

Ah, perhaps so. The KSS docs mentions a $modifier_class convention, but I've found the one nkss implements to be easier and more compatible with HAML.

pboling pushed a commit to trumaker/nkss-rails that referenced this issue Jun 11, 2014
…orrectly

クラス名が正しく出力されない問題を修正
@kpingel
Copy link

kpingel commented Mar 14, 2016

I'm able to get the modifier classes working, but the pseudo states are not working for me. I was looking at the following issue for reference: kss-node/kss-node#51

It looks like kss.js handles the pseudo classes? But aside from adding it to the layout file, I'm not sure what else needs done. Suggestions?

@rstacruz
Copy link
Member

nkss-rails is unmaintained at the moment, sorry. Any help would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants