5

I created a sub-theme bootstrap version of CDN.

I based on "Journal" version "3.3.6" and I personalized my style.css file with 900 lines.

enter image description here

https://bootswatch.com/

I no longer wish to use the CDN, but I like to keep my current theme "Journal" and my custom style sheet.

How can I do this without using "less"?

What I want is to work with CSS

I asked this question several weeks ago but I still have not found a solution :

Install without Bootstrap CDN

enter image description here

Zuzuesque thank you your solution works, but I am having display problem :

  • I no longer have the "glyphicons"

  • The menu bar is not displayed correctly

  • The admin menu is hidden by the menu bar

  • Can you clarify what you mean ... If you don't want a CDN in front of your site, simply turn it off. A CDN requires you to setup your DNS so that your traffic is routed to your CDN first and it decides what requests to send back to your origin based on the rules and config you have setup. – bleen Jul 31 '16 at 20:28
  • @bleen I've updated the question – user54067 Jul 31 '16 at 20:53
  • Since you can write css into less files - I guess what you really want to do is avoid converting less to css on regular basis? – Zuzuesque Aug 1 '16 at 18:29
  • @Zuzuesque No, what I want is to use only css. I download the "bootstrap library" module, but I do not know how to put the basic theme "Journal" – user54067 Aug 1 '16 at 18:38
  • Compiled less turns into regular css... so you are basically only using css even with less. That's why I asked if you don't want to do any converting - which from your answer I assume is a yes. I will try to provide an answer. – Zuzuesque Aug 1 '16 at 18:44
6

You will need to switch the module you are using - Bootstrap Library is not suited to be used without CDN. The main function this module provides is connection to a CDN of your choice - not provide a theme (or css) itself.

The module you will want to use is the Bootstrap Theme. This one provides a sub-theme you can expand upon.

To get the Bootstrap Theme going:

  1. Disable your old Journal theme + move it from the theme folder - that's important. (Maybe make a backup somewhere).
  2. Download the Bootstrap Theme from the Drupal site and put it in your theme folder. (And leave it there)
  3. Create a subtheme following the instructions for the less-starterkit (you wont need to touch less no worries) here: Sub-Theming Bootstrap. Basically you copy the bootstrap_subtheme folder from the bootstrap theme into your theme folder and rename the folder to journal (your theme name). You also rename ./journal/less.starterkit to ./journal/journal.info.
  4. Open your new .info file and change name + description. (You can copy it from your old theme.)
  5. Download the latest 3.x.x version of the of Bootstrap Framework Source Files into your new sub-theme. After it has been extracted, the folder should read ./journal/bootstrap. (Don't modify the files in this folder, this folder allows you to later update Bootstrap without overwriting your changes.)
  6. Download the journal theme css from bootswatch. Copy it into your journal/css folder. (This is the file which was previously provided by the CDN.) It should now read journal/css/bootstrap.min.css
  7. Open your .info file again, find the line stylesheets[all][] = css/style.cssand add a line right above it: stylesheets[all][] = css/bootstrap.min.css. This will load the default journal css.
  8. Now you need to copy your custom changes into the new theme. Copy your custom css into css/style.css and your template files (if you have any custom template files) into the journal/templatesfolder.
  9. Enable your new Journal theme.

Glyphicons

Check your subtheme... there should be a folder fonts. If there is no such folder create one. Then navigate to the bootstrap source files you put in the bootstrap folder of your theme, find the font folder there and copy all font files in your own font folder. (This is needed because the default css looks for the fonts under ../fonts/font-name)

Headermenu

Have you checked the settings of your new theme in the UI? It has a couple of menu bar settings, maybe you are just using the wrong one. Generally bootstrap works nicely with the admin menu, at least on all sites I have it on. It is possible, that some of your custom css is interfering with the default bootstrap theme setup. In that case you would need to do some debugging on your custom css. From what I see though it might be enough for the front end to give the main-container a top margin of 60-70px.

  • I've updated the question – user54067 Aug 1 '16 at 22:57
  • Updated my answer – Zuzuesque Aug 2 '16 at 7:59
  • For fonts, it works. But for the display problem, do not put it in the folder "CSS", 3 files ? "Bootstrap.css" (the basic theme), "bootswatch.css" (the journal theme) and "style.css" (my customization) – user54067 Aug 2 '16 at 16:46
  • Bootswatch css files are replacements for the default css files shipped with Bootstrap - you will only need bootstwatch.css and style.css. Quote from bootswatch: "Simply download a CSS file and replace the one in Bootstrap. No messing around with hex values." I believe your problem comes from your custom css, maybe you have to do some (minor) corrections to fit the underlaying bootstrap theme. – Zuzuesque Aug 2 '16 at 18:32
  • I found. We must "bootstrap.min.css" (bootswatch) "overrides-journal.min.css" (bootstrap theme / css / 3.3.6) and "style.css" – user54067 Aug 2 '16 at 18:37
0

I was able to disable use of the CDN in Drupal Bootstrap 7.x-3.25 in a subtheme we can call subtheme_name.

First I loaded the site with the CDN enabled, and then went into the browser developer tools, looked at the network tab, reloaded the page, then copied the URLs for bootstrap.css, drupal-bootstrap.css and bootstrap.js. I then downloaded those files from the CDN and put them into the subtheme_name/bootstrap/css/ and subtheme_name/bootstrap/js/ directories I created.

I added these lines to the Stylesheets section of subtheme_name.info:

stylesheets[all][] = bootstrap/css/bootstrap.css
stylesheets[all][] = bootstrap/css/drupal-bootstrap.css

I added this line to the Scripts section of .info file:

scripts[] = 'bootstrap/js/bootstrap.js'

I uncommented settings[bootstrap_cdn_provider] = '' in that file, then ran drush cc all to clear the cache. Network tools now say that the files come from the site, not the CDN.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy