掲示板

override tablet breakpoint variable.

thumbnail
8年前 に nicolas saubi によって更新されました。

override tablet breakpoint variable.

Junior Member 投稿: 43 参加年月日: 09/10/28 最新の投稿
Env : Linux Debian
Liferay : 6.2 GA4 (CE)
Framework : Struts 1.2.9. Bootstrap 2.3 from L6.2 + Bootstrap 3 imported in custom.css file.
Theme inherits from classic theme.
Builder : Maven


Hi, I'm having problems overriding the tablet breakpoint for the "respond-to" mixins.

Searching through all css / scss file, I could not find this var : $breakpoint_tablet (found it thanks to google search). I don't know if my theme mixins uses it.
I tried to override this var by placing it in :
- custom.css
- main.css
- _my_own_var.scss (imported in main, in custom)

In some case, it works partially, meaning some css still uses old configuration (extras.css by example).

I don't know where to override it to be global.

Here is my theme css / scss files :

application.css
aui
aui.css
base.css
bootstrap-3.3.5-custom.css
color_schemes
custom.css
custom_common.css
custom_responsive.css
dockbar.css
extras.css
layout.css
list.txt
main.css
navigation.css
portlet.css
sprites.scss
_aui_custom.scss
_aui_variables.scss
_custom_vars.scss
_liferay_custom.scss


AUI DIRECTORY

alloy-font-awesome
bootstrap.scss
list.txt
responsive.scss
_accordion.scss
_alerts.scss
_breadcrumbs.scss
_button-groups-alloy.scss
_button-groups.scss
_buttons-alloy.scss
_buttons.scss
_carousel-alloy.scss
_carousel.scss
_close.scss
_code.scss
_component-animations.scss
_dropdowns.scss
_forms.scss
_grid.scss
_hero-unit.scss
_labels-badges.scss
_layouts.scss
_media.scss
_mixins.scss
_modals-alloy.scss
_modals.scss
_navbar.scss
_navs-alloy.scss
_navs.scss
_pager.scss
_pagination-alloy.scss
_pagination.scss
_popovers-alloy.scss
_popovers.scss
_progress-bars-alloy.scss
_progress-bars.scss
_reset.scss
_responsive-1200px-min.scss
_responsive-767px-max.scss
_responsive-768px-979px.scss
_responsive-navbar.scss
_responsive-utilities.scss
_scaffolding.scss
_sprites.scss
_tables.scss
_thumbnails.scss
_tooltip-alloy.scss
_tooltip.scss
_type.scss
_utilities-alloy.scss
_utilities.scss
_variables-alloy.scss
_variables.scss
_wells.scss


Thanks for you help.
If you want to talk about it I'm nearly all days on #liferay on freenode irc chan (I'm on GMT+1 time zone, meaning I think PST+9)
thumbnail
8年前 に Travis Cory によって更新されました。

RE: override tablet breakpoint variable.

Junior Member 投稿: 73 参加年月日: 13/06/04 最新の投稿
Hello Nicolas,

I'm sorry for the frustration this has been causing you. The default value for the breakpoint can be found in _mixins.scss, which is the file that is being imported through
@import "mixins"
. If you want to change this globally across your portal I recommend using a hook to change that file.
thumbnail
8年前 に nicolas saubi によって更新されました。

RE: override tablet breakpoint variable.

Junior Member 投稿: 43 参加年月日: 09/10/28 最新の投稿
Sheeeesh !

I had already looked into _mixins.scss, but the one compiled in the target directory of my theme, which does not include those vars (don't know why).

So 3 questions related to your answer :

1 - What's the difference between the _mixins.scss from portal-6.2/portal-web/docroot/html/css/common/_mixins.scss and the one I have in /my-theme/target/theme-name/css/aui/_mixins.scss when building it with maven ?

2 - Can't I override the _mixins vars directly from my theme (by overriding this _mixins.scss file) ?

3 - Isn't there any "custom_vars.scss" file which would always be loaded before all others scss files ? So we only would have to modify this one to modify whatever we want ?
3b - If not, where should I create this custom_vars.scss file and where should it be integrated to be always taken into consideration by all others scss files ?


Thanks in advance.

EDIT :
I just tried to hook the _mixins.scss following this structure in my hook :
src/main/webapp/custom_jsps/html/css/common/_mixins.scss

Unfortunately, when maven builds my war, I still have old vars in extras.css.
I tried to copy and paste the portal _mixins.scss into my theme, and set my var there. Not working neither.

Don't forget we're working with Maven, if it matters concerning this problem...
thumbnail
8年前 に Travis Cory によって更新されました。

RE: override tablet breakpoint variable.

Junior Member 投稿: 73 参加年月日: 13/06/04 最新の投稿
Hey Nicolas,

I'll answer your questions individually:

1. The mixins found in your theme are mixins ported from Bootstrap. If you look at the src code from our translation of Bootstrap you'll see the mixins file. The mixins found in docroot/html/css/common/ are Liferay created mixins that are used throughout the portal CSS.

2. I tested this locally and was able to define my own breakpoint for my theme by redefining the variables after importing the mixins in my custom.css

@import "mixins";

$breakpoint_phone: {new value};
$breakpoint_tablet: {new value};



3. Are you trying to override the variables used for Bootstrap? Or simply the variables used in the repond-to mixin?
thumbnail
8年前 に nicolas saubi によって更新されました。

RE: override tablet breakpoint variable.

Junior Member 投稿: 43 参加年月日: 09/10/28 最新の投稿
Hey Travis and thanks for your time,


1 - ok


2 - yes same here, BUT... others files including some respond-to mixins don't use the var I define in my custom.css...
By example if I want to override tablet width with 1000px (default is 979px) :
custom.css:

@import "mixins";
$breakpoint_tablet: 1000px;

div {
      @include respond-to(phone, tablet) {
             color:blue;
      }
}


My code will end up with custom rules with 1000px (ok), but others inherited rules (extras.css, whatever.css) are still in 979px (they use respond-to mixins too), breaking the display.
I did not want to override each css file which use respond-to mixins just to add my var $breakpoint_tablet: 1000px; Is it possible not to ?


3 - Lets say I want to do both, so if I have to in the next days, I know how to do emoticon But in my actual case, I want that all files containing respond-to mixins, being a file in my theme or inherited from the classic theme, use my variable $breakpoint_tablet instead of the one defined somewhere (in the _mixins file from portal I bet).
Btw I tried the hook, and it seems not to work. I must be doing something wrong...
What I do is :
a - turn tomcat off
b - erase work, tmp, and the webapps/my_theme directory.
c - turn tomcat on
d - deploy my hook with the _mixins file with my var set
e - deploy my_theme
f - cry because I still have multiple instances of max-width: 979px in my css, when I should only have max-width: 1000px (like I said, in extras.css, in custom_responsive.css, etc.)
thumbnail
8年前 に Travis Cory によって更新されました。

RE: override tablet breakpoint variable.

Junior Member 投稿: 73 参加年月日: 13/06/04 最新の投稿
Hey Nicolas,

I'm sorry for your frustration. In light of wanting to change the breakpoint across the entire theme, I'd suggest a hook. The nice thing about the hook is that all files that use respond-to would use your new variables. You'd really only need to update the file once to change the breakpoint globally. I haven't worked much in maven, but I found a helpful article on the Liferay Developer Network that covers creating hooks in maven. Let me know if you have any more questions. I'd double check in your liferay-hook.xml that you are setting up the path to your custom_jsps correctly.
thumbnail
8年前 に nicolas saubi によって更新されました。

RE: override tablet breakpoint variable.

Junior Member 投稿: 43 参加年月日: 09/10/28 最新の投稿
Hey Travis,

my hook is actually working, as I can see the modified file in :
/webapps/ROOT/html/css/common

and the old _mixins.scsss file as _mixins.portal.scss.

Fact is I just saw what is our problem here : all the .sass_cache directories are filled with old files.

I am deleting each time I build my theme my workspace/theme .sass_cache directory, BUT :

1 - the war created still get a .sass_cache directory full of bad css (with old variable and not new one). So I have to open the .war archive and clean the .sass_cache directory.
How to construct with maven a proper .war with updated .sass_cache files ? Actually it's not working (building gives a .sass_cache directory full of crap)

2 - my server webapps ROOT is full of .sass_cache directories with bad files too. I'm removing all content manually.
How to do it properly ?


Thanks one more time for your help. I hope this thread will help other people too emoticon


EDIT :
I added this to my parent pom and now no more .sass_cache directory in my war. Point 1 seems ok then. Cool. :

<plugin>
	<groupid>org.apache.maven.plugins</groupid>
	<artifactid>maven-war-plugin</artifactid>
  	<configuration>
	    	<packagingexcludes>**/.sass-cache/**</packagingexcludes>
  	</configuration>
</plugin>
thumbnail
8年前 に Travis Cory によって更新されました。

RE: override tablet breakpoint variable.

Junior Member 投稿: 73 参加年月日: 13/06/04 最新の投稿
Hey Nicolas,

I'm happy to help. I mostly develop using ant so there are some maven concepts that I don't fully understand. I'm sorry abouy the SASS cache issues that does sem frustrating. I did a quick search for the respond-to mixin and it looks like it is really only being used in the ROOT/html/css/ directory. What if you just erase that .sass-cache/ directory? After you do that I'd recommend restarting your server, deleting the temp and work folder and restarting your server. Just to make sure all the cache is flushed out. Thanks for your patience!
thumbnail
8年前 に nicolas saubi によって更新されました。

RE: override tablet breakpoint variable. (回答)

Junior Member 投稿: 43 参加年月日: 09/10/28 最新の投稿
Hey Travis,

good day today (well yesterday in fact) ! All problems are gone.


As a summary, if you want to override a variable from themes, you have to :

1 - find the css or scss file in the portal where the var is declared.

2 - build a hook for this file and override the variable. As Liferay maven plugin does not allow to hook for css but only for jsp, just do a jsp hook archetype and create the folder tree needed for the css. If hook is correctly deployed, you'll have your files (and old portal ones) in your webapps/ROOT/[hook_files_path]

3 - using maven, add the following build plugin in your pom.xml :
<plugin>
	<groupid>org.apache.maven.plugins</groupid>
	<artifactid>maven-war-plugin</artifactid>
	<configuration>
	    	<packagingexcludes>**/.sass-cache/**</packagingexcludes>
	</configuration>
</plugin>


4 - on your server, go to the tomcat folder and erase all .sass-cache folders. On linux this simple command is enough :
find . -type d -name '.sass-cache' -exec rm -rf {} +


5 - now deploy your theme. Normally war should not contain any .sass-cache folder, neither your server. All sass files should now use the hooked variable.



Done. emoticon