Sha256: bbe2230ebbeb646ca039319ec03083b47a0b1d416966f66a829288a28ef08367

Contents?: true

Size: 1.76 KB

Versions: 7

Compression:

Stored size: 1.76 KB

Contents

run 'bundle install'
# TODO removing is probably not good idea when adding bootstrap to existing project
remove 'app/views/layouts/application.html.erb'

system "yarn add jquery bootstrap eonasdan-bootstrap-datetimepicker moment"

insert_into_file "#{@project_path}/app/assets/stylesheets/application.css",
                 before: "\n *= require_tree ." do <<-TXT
 
 *= require bootstrap/dist/css/bootstrap
 *= require eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker
TXT
end

insert_into_file "#{@project_path}/app/assets/javascripts/application.js",
                 before: "\n//= require_tree ." do <<-TXT
                 
//= require bootstrap/dist/js/bootstrap
//= require moment/min/moment-with-locales
//= require eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min
TXT
end

insert_into_file "#{@project_path}/app/javascript/packs/application.js",
                 after: "console.log('Hello World from Webpacker')" do <<-JS
                 
import jQuery from 'jquery'
window.jQuery = jQuery

let ready;
ready = function() {
  $(".datepicker").datetimepicker({locale: 'cs', format: 'D. M. YYYY'});
};
// Fire javascript after turbolinks event
$(document).on('turbolinks:load', ready);
JS
end

insert_into_file "#{@project_path}/config/webpack/shared.js",
                 after: "new ManifestPlugin({ fileName: paths.manifest, publicPath, writeToFileEmit: true })
  ]," do <<-JS
  
  resolve: {
    alias: {
      jquery: "jquery/src/jquery"
    }
  },
JS
end

insert_into_file "#{@project_path}/config/webpack/shared.js",
                 after: "new ExtractTextPlugin(env.NODE_ENV === 'production' ? '[name]-[hash].css' : '[name].css')," do <<-JS
  
  new webpack.ProvidePlugin({
    $: 'jquery',
    jQuery: 'jquery',
    jquery: 'jquery'
  }),
JS
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
r5-0.5.0.0 lib/r5/recipes/bootstrap.rb
r5-0.4.0.5 lib/r5/recipes/bootstrap.rb
r5-0.4.0.4 lib/r5/recipes/bootstrap.rb
r5-0.4.0.2 lib/r5/recipes/bootstrap.rb
r5-0.4.0.1 lib/r5/recipes/bootstrap.rb
r5-0.4.0.0 lib/r5/recipes/bootstrap.rb
r5-0.3.0.0 lib/r5/recipes/bootstrap.rb