I'm styling a Hanami project and I'm using W3.CSS. I have a whole bunch of entities that are styled the same, so instead of having a myriad of identical styles across a hundred files, I want to use LESS to combine W3.CSS styles, so that if changes are necessary, I would only need to implement them in one location.
After hours of perusing Google, I got things working using therubyracer and less gems.
This is my working sample styles.css.less
file:
@import (less) "w3.css";
@import (less) "w3-theme-blue.css";
.test-combined-container {
.w3-container();
.w3-card();
}
.test-center {
.w3-center();
.w3-theme();
}
This works.
However, there is one issue that I noticed, specifically with classes like w3-striped, w3-bordered, w3-hoverable, w3-hover-theme and w3-row. When using these classes, LESS says it finished as usual, but also throws the following error:
GET http://localhost:2300/assets/godmode/styles.css net::ERR_ABORTED 500 (Internal Server Error)
I suspected the issue was the use of pseudo-classes, but that turned out to be wrong.
I tried the following:
I tried importing W3.CSS stylesheets as css and inline. This didn't work.
Next I tested the "w3-hover-theme" class from the "w3-theme-blue.css".
I tried adding empty w3-hover-theme class before and after the import declaration. No error, but hover is not applied.
I tried adding empty w3-hover-theme class in an external css and importing it. No error, but hover is not applied.
I tried adding empty w3-hover-theme class in the w3-theme-blue.css file before the first use of the class together with the :hover pseudo-class. No error, but hover is not applied.
I retested with "color: red;" in the w3-hover-theme class, and that was applied, but the hover still didn't work.
So I added:
.test-center:hover {
color: green;
}
This got hover to work, obviously, but that kinda defeats the purpose.
Can anyone point me in the right direction as to what the specific issue might be that some classes break LESS in Hanami and how to fix it/work around it?
EDIT: It's been suggested that this question is a duplicate. It's not. The suggested post is dealing entirely with LESS, I'm trying to "merge" W3.CSS classes with LESS and the issue I have is that it works with some classes but not others. I'm testing with extend, but haven't gotten a positive result yet.