Class: Bootstrap4jekyll::Plugin

Inherits:
Object
  • Object
show all
Defined in:
lib/bootstrap4jekyll/plugin.rb

Overview

The plugin functionality that adds the Twitter-Bootstrap-framework to the Jekyll site.

Instance Method Summary collapse

Instance Method Details

#add_bootstrap_assets(site) ⇒ Object

The assets delivered together with the bootstrap GEM will be added to the site.



28
29
30
# File 'lib/bootstrap4jekyll/plugin.rb', line 28

def add_bootstrap_assets(site)
  site.static_files.concat jekyllized_bootstrap_files(site) if assets_enabled?(site)
end

#complete_load_paths(site) ⇒ Object

Add the paths of bootstraps scss partials to the global sass-load-path.

Parameters:

  • site (Jekyll::Site)

    represents site-wide information and configuration settings.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/bootstrap4jekyll/plugin.rb', line 11

def complete_load_paths(site)
  # fetch the the path to the bootstrap partials.
  bootstrap_partials = File.expand_path('stylesheets/', ::Bootstrap.assets_path)

  # make sure there is a 'sass' key-entry in the config settings.
  site.config['sass'] = { 'load_paths' => [] } unless site.config['sass']
  sass_config = site.config['sass']

  # make sure that the sass_config has a 'load_paths' key-entry.
  sass_config['load_paths'] = [] unless sass_config['load_paths']
  # make sure that the 'load_paths' entry is an array and not just a string
  sass_config['load_paths'] = Array(sass_config['load_paths'])
  # add the bootstrap partials to the sass-load-paths
  sass_config['load_paths'] << bootstrap_partials
end