Loading...
Find
Log in
Username:
Password:
CapsLock is on.
Remember me (for 1 week)
Log in
Stay in SSL mode
History: Updating a Tiki theme from Bootstrap 3 to 4
View page
Collapse Into Edit Sessions
Source of version: 5
«
»
This document is a work in progress, as Bootstrap 4 is still in beta at the time of this writing. But theme-related details are probably pretty stable so the method described here should continue to be useful. The Bootstrap developers have taken pains to facilitate custom themes compared to what was offered for release 3, and this helps us as Tiki theme creators/maintainers. For an overview of (generic) Bootstrap theming, see [http://getbootstrap.com/docs/4.0/getting-started/theming/]. !! Less to SCSS (Sass) Bootstrap 4 uses SCSS precompiling rather than Less, so the workflow needs to be switched accordingly. As before, compiling can be done with PHP in the terminal in PhpStorm. Or the .scss files can be compiled by another method. In my work on this so far, I found that PHP compiling isn't very verbose when there are errors, and when updating or making a theme there tend to be a lot of errors in my experience. !!! Scout There is an application called Scout ([http://scout-app.io/]), however, that can work nicely as part of the workflow to compile the theme files and get better error notices when things need to be fixed. It's free and available for MacOS, Linux, and Windows. After installing Scout, just add the theme as a project and Scout will watch for file changes as you edit the .scss files, and will compile in the background and specify the problematic file and line and nature of the problem when there's an error. (Then, if you're working on the Tiki project files so need to use PhpStorm for inter-developer consistency, when the compiling goes smoothly you can compile again in PhpStorm and commit the files.) !!! Rename MyTheme.less and update it MyTheme.less will now be MyTheme.scss, and of course all the files it imports will have .scss extensions instead of .less. Tiki's base CSS files have already been through this process, so the import paths will be correct. I've found that SCSS is not as forgiving as Less in regard to the order that files are imported and variables defined. To avoid compiling errors, this is the order of partials imports that has been successful for me: {CODE(title="Contents of MyTheme.scss")} @import "../../../vendor_bundled/vendor/twbs/bootstrap/scss/functions"; // These two needed to prevent @import "../../../vendor_bundled/vendor/twbs/bootstrap/scss/_variables.scss"; // compiling errors. @import "../../base_files/scss/_tiki-variables.scss"; // Values/definitions for Tiki variables (outside of Bootstrap variables) such as _tiki-selectors.scss. @import "_bootstrap-variables.scss"; @import "../../../vendor_bundled/vendor/twbs/bootstrap/scss/bootstrap.scss"; // Needed for darken function. @import "../../base_files/scss/_tiki-selectors.scss"; @import "../../base_files/scss/_bs3-bs4-transition.scss"; // To be phased out. @import "_tiki-selectors.scss"; @import "../../base_files/scss/_external-scripts.scss"; {CODE} ''Note: The file _bs3-bs4-transition.scss is a temporary file the content of which will eventually be relocated or redefined - it was just a kludge to get to a clean compile of the base files.'' !!! Prepare the variables file The way I've been doing it, I rename the theme's bootstrap-variables.less file to _boostrap-variables.scss (using here the SCSS convention of starting the name of the partial file with an underbar, to prevent it from being compiled into bootstrap-variables.css), and then delete everything below the file identification/comments lines at the top (I remove all the variables information). Then I paste in an outline of commented-out lines to provide some structure for the variables that I'm going to be adding back in. The outline looks like this: !!!!- Initial outline in _bootstrap-variables.less {CODE()} //$Id$ //Custom styles for a new theme. // Colors // $white: #fff !default; // $gray-100: #f8f9fa !default; // $gray-200: #e9ecef !default; // $gray-300: #dee2e6 !default; // $gray-400: #ced4da !default; // $gray-500: #adb5bd !default; // $gray-600: #868e96 !default; // $gray-700: #495057 !default; // $gray-800: #343a40 !default; // $gray-900: #212529 !default; // $black: #000 !default; //$primary: #ad1d28; //$success: #48ca3b; //$info: #4d3a7d; //$warning: #debb27; //$danger: #df6e1e; //$theme-colors: ( // "primary": #ababab, // "secondary": #dddddd, // "success": #5cb85c, // "info": #5bc0de, // "warning": #f0ad4e, // "danger": #d9534f, // "light": #ffffff, // "dark": #000000 //); // Options // Spacing // Body //$body-color: $gray-800; // Links // Components //$padding-base-vertical: .5rem; //$padding-large-vertical: .9rem; // Fonts //$font-family-sans-serif: Verdana, Geneva, Arial, Helvetica, sans-serif; // Tables //$table-border-color: #dddddd; // Buttons //$btn-default-color: #ffffff; //$btn-default-bg: #3676c4; //$btn-default-border: #3676c4; //$btn-primary-color: #ffffff; //$btn-primary-bg: #3676c4; // Forms //$input-border: #dddddd; // Dropdowns // Navs // Navbar //$navbar-dark-color: #ffffff; //$navbar-dark-bg: #1f5daa; //$navbar-dark-border: darken($navbar-dark-bg, 6.5%); // Navbarlinks ?? //$navbar-dark-color: #ffffff; //$navbar-dark-hover-color: darken(#fff, 10%); //$navbar-dark-hover-bg: #3270bd; //$navbar-dark-active-color: #ffffff; //$navbar-dark-active-bg: #3270bd; //$navbar-dark-disabled-color: #cccccc; // Pagination // Jumbotron // Cards //$card-border-radius: $border-radius-lg; //$card-text: #fff;//@gray-lighter; //$card-heading-bg: #386dbb; // Tooltips // Popovers // Badges // Modals //$modal-header-border-color: #386dbb; // Alerts // Progress bars // List group // Image thumbnails // Figures // Breadcrumbs // Carousel // Close // Code {CODE} As is evident, the file contains section headings and some typical variable definitions that may need changing. The headings should probably stay in place, but any unused variables/definitions should be removed or replaced. !!! Get the variables to be used If the Mytheme's bootstrap-variables.less file (or variables.less file) is the equivalent of the Bootstrap default variables.less file, but with values specific to the theme, then it's pretty easy to see which variables need to be used in the theme's variables.scss file for Bootstrap 4/Tiki 19. I generally use a Windows application called WinMerge to get the side-by-side diff view, but PhpStorm or another editor can be used, of course. I go down the files, copying the variables that are changed from the Bootstrap default, and pasting them into the new _bootstrap-variables.scss file. Of course in SCSS variable names start with "$" rather than "@", so this needs to be changed for each variable. Many of the Bootstrap 3 variable names are carried over to Bootstrap 4, but not all, so it's good to have a resource on hand that lists the new variable names. I check Bootstrap 4's _variables.scss file, for one thing. So the variables to be used are pasted or input in the theme's _bootstrap-variables.scss file.
History
Enable pagination
rows per page
HTML diff
Side-by-side diff
Side-by-side diff by characters
Inline diff
Inline diff by characters
Full side-by-side diff
Full side-by-side diff by characters
Full inline diff
Full inline diff by characters
Unified diff
Side-by-side view
HTML diff
Side-by-side diff
Advanced
Information
Version
Mon 29 of Oct, 2018 18:33 GMT
luci
11
Sat 13 of Oct, 2018 00:02 GMT
luci
10
Fri 12 of Oct, 2018 21:42 GMT
luci
9
Sun 15 of Jul, 2018 16:49 GMT
chibaguy
Updated "MyTheme.scss" contents.
8
Wed 17 of Jan, 2018 08:19 GMT
chibaguy
Added link: CSS Flexible Box Layout
7
Fri 15 of Dec, 2017 14:02 GMT
chibaguy
Added more info.
6
Fri 15 of Dec, 2017 13:34 GMT
chibaguy
Info added.
5
Fri 15 of Dec, 2017 12:41 GMT
chibaguy
Wording improvement.
4
Fri 15 of Dec, 2017 11:42 GMT
chibaguy
3
Fri 15 of Dec, 2017 11:41 GMT
chibaguy
Info added about compiling.
2
Fri 15 of Dec, 2017 10:54 GMT
chibaguy
Page created.
1
Select action to perform with checked...
Remove
OK
Switch Theme
Site theme (fivealive-lite/grape)
Default
Amelia
Business
Cerulean
Cosmo
Cyborg
Darkly
Darkroom
Darkshine
Feb12
Fivealive-lite
Fivealive
Flatly
Greenvalley
Journal
Jqui
Lighty
Litera
Lumen
Lux
Materia
Minty
Morph
Ohia
Pulse
Quartz
Sandstone
Simplex
Sketchy
Slate
Solar
Spacelab
Strasa
Superhero
Thenews
Tikicorp
Tikinewt
Tikipedia
United
Utopias
Vapor
Yeti
None
Akebi
Grape
Kiwi
Lemon
Orange
Plum
Raspberry
Watermelon
Switch
Layout
Stay on this page
Default
Fixed top navbar (uses site icon + "topbar" module zone)
Basic Bootstrap
Classic Tiki (3 containers - header, middle, footer)
Tikipedia
Latest Changes
No records to display
...more
Subscribe to Tiki Newsletters!
Delivered fresh to your email inbox!
Don't miss major announcements and other big news!
Site Config
Site upgraded to Tiki 23.x
Sat 24 of Jul, 2021 00:30 GMT
Site upgraded to Tiki 20
Wed 29 of May, 2019 07:57 GMT
We are now on Tiki 19.x
Fri 05 of Oct, 2018 10:02 GMT
Shoutbox module removed
Thu 28 of Jun, 2018 07:01 GMT
We are now on Tiki 18.x
Wed 02 of May, 2018 08:46 GMT
Upgraded to Tiki 17.0
Wed 02 of Aug, 2017 08:19 GMT
Upgraded to Tiki 15.0alpha
Tue 08 of Mar, 2016 13:34 GMT
Site updated to Tiki 14 beta
Tue 21 of Apr, 2015 00:01 GMT
Testing Tiki10
Thu 15 of Nov, 2012 23:06 GMT
Configurable header buttons in XtratoVeil layout
Wed 17 of Oct, 2012 14:54 GMT