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

use a lot more variables in Sass/LESS #67

Open
jonbcampos opened this issue Jul 6, 2015 · 4 comments
Open

use a lot more variables in Sass/LESS #67

jonbcampos opened this issue Jul 6, 2015 · 4 comments

Comments

@jonbcampos
Copy link

I've been playing with the project, great work so far.

Overriding the built in options is really painful as I have to have a second sheet that I've written out just to override all of the options within the framework.

Example:

.icon-float-away(){
  ... some stuff ...
  &:before,
  &:after {
    content: "\f055";
    position: absolute;
    right: 1em;

It would be great if you moved these options to a variables.less file (which is common in LESS projects) so they could be overridden. The update would look something like:

.icon-float-away(){
  ... some stuff ...
  &:before,
  &:after {
    content: @hvr-icon-float-away;
    position: absolute;
    right: @hvr-icon-right-position;

That way in a single file I just change:

@hvr-icon-right-position: 1em;

to

@hvr-icon-right-position: 2em; (or whatever value)

without a lot of work.

@IanLunn IanLunn changed the title use a lot more variables in LESS use a lot more variables in Sass/LESS Oct 21, 2016
@IanLunn
Copy link
Owner

IanLunn commented Oct 21, 2016

Unfortunately I will be removing LESS in the next major realease due to supporting both Sass and LESS is too much work. I will however consider adding more variables to the Sass version.

@HunterGraubard
Copy link

I just came here to request this. I'm sad to see this has been open for years. It's a pain to work with from SCSS as it is currently.

@IanLunn
Copy link
Owner

IanLunn commented Apr 13, 2018

@jonbcampos @HunterGraubard Can this not be done by relying on the CSS cascade? What is the benfit to doing it via SCSS variables?

@HunterGraubard
Copy link

HunterGraubard commented Apr 15, 2018

I have a project that's already heavily making use of SCSS, and I want to integrate Hover.css into it. For example, from a certain style in my code, I want to call the mixins directly and supply parameters to those mixins. I don't think this is quite what the OP was asking for, but it was requested in #93, and that was closed as a duplicate of this.

Hover.css's mixins do not take any parameters, and instead just rely on global variables. This means that in order to use the mixin with the parameters I want, I have to override the global variables before calling the mixin. It works, but it's a hack and feels very ugly/messy:

$primaryColor: blue !global;
$activeColor: red !global;
$mediumDuration: .5s !global;
@include radial-out();

Additionally, the lack of variables means that some things just can't be done in this way. For example, the sweep-to-right effect forces a color of white for the mouse-over effect. If I want to change it, I have to specifically overwrite it with the following:

@include sweep-to-right();
&:hover,
&:focus,
&:active {
    color: $my-color;
}

Which is a lot messier than simply passing a variable into a mixin.

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

No branches or pull requests

3 participants