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

Add postfix option #126

Closed
wants to merge 2 commits into from
Closed

Add postfix option #126

wants to merge 2 commits into from

Conversation

jlong
Copy link
Contributor

@jlong jlong commented Oct 7, 2013

This is a fast pass at implementing this. I prefer that my icon classes end with "-icon" instead of begin with "icon-".

Unfortunately, Thor seems to have problems with parsing arguments that begin with a dash. Even when parsing "--postfix=-icon". Any ideas?

@jlong
Copy link
Contributor Author

jlong commented Oct 7, 2013

Just added a crazy hack to help Thor with the parsing. Not ideal, but maybe this can work until we get Thor to fix it's issues with leading dashes.

@kaizau
Copy link
Member

kaizau commented Oct 7, 2013

Thanks for bringing this up. I ran a quick experiment, and it seems Thor handles the alias flag and a quoted string just fine. fontcustom compile -p "--example"

That said, I'm a bit hesitant to add yet another option, nevermind hack up ARGV. A more robust approach would be to allow passing in a class name "template", something like --css-class=prefix-{{glyph}}-postfix.

In the meantime, you can use your fork or a custom template with your postfix hardcoded in. Thoughts?

@jlong
Copy link
Contributor Author

jlong commented Oct 8, 2013

Are you trying this in code or on the console? Bash removes the quote marks which causes the problem with Thor.

On Oct 7, 2013, at 6:47 PM, Kai Zau notifications@github.com wrote:

Thanks for bringing this up. I ran a quick experiment, and it seems Thor handles the alias flag and a quoted string just fine. fontcustom compile -p "--example"

That said, I'm a bit hesitant to add yet another option, nevermind hack up ARGV. A more robust approach would be to allow passing in a class name "template", something like --css-class=prefix-{{glyph}}-postfix.

In the meantime, you can use your fork or a custom template with your postfix hardcoded in. Thoughts?


Reply to this email directly or view it on GitHub.

@jlong
Copy link
Contributor Author

jlong commented Oct 8, 2013

I like the idea of --css-class, but I noticed that Bootstrap applies styles based on classes beginning with "icon-". There's no CSS equivalent for /prefix-*-postfix/, so matching that pattern would be difficult. I this case I think --css-postfix is the cleanest way of implementing this.

--John

On Oct 7, 2013, at 6:47 PM, Kai Zau notifications@github.com wrote:

Thanks for bringing this up. I ran a quick experiment, and it seems Thor handles the alias flag and a quoted string just fine. fontcustom compile -p "--example"

That said, I'm a bit hesitant to add yet another option, nevermind hack up ARGV. A more robust approach would be to allow passing in a class name "template", something like --css-class=prefix-{{glyph}}-postfix.

In the meantime, you can use your fork or a custom template with your postfix hardcoded in. Thoughts?


Reply to this email directly or view it on GitHub.

@kaizau
Copy link
Member

kaizau commented Nov 3, 2013

After thinking about this more, I'm going to shelve this for now. Postfixing doesn't seem like a common practice and can be achieved with custom templates, if absolutely necessary.

That said, you can still match "sandwiched" classes with attribute selectors: http://codepen.io/anon/pen/fFEwL

Thanks again!

@kaizau kaizau closed this Nov 3, 2013
@jlong
Copy link
Contributor Author

jlong commented Nov 3, 2013

@EZYZ Actually no. That will only work when one class is applied to an element. More than one and it will use the first and last classes, which isn't what anyone wants.

Postfix seems like a fairly reasonable request if you support prefixes. I'm not sure why whether it comes before or after makes any difference. Different CSS methodologies call for different practices. Here's mine:

http://thesassway.com/advanced/modular-css-naming-conventions

The section on subclasses is what's applicable here.

Granted all of this is certainly achievable with custom templates, but if that's the argument let's turn that argument on it's head and ask why provide the prefix option at all?

@kaizau
Copy link
Member

kaizau commented Nov 25, 2013

@jlong I just included this in the latest beta. Setting css_selector to .{{glyph}}-icon should accomplish what you're looking for.

Note, you'll need to delete your old .fontcustom-manifest.json and change css_prefix to css_selector in fontcustom.yml for this version to work.

gem install fontcustom --pre

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

Successfully merging this pull request may close these issues.

2 participants