Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
Rename vendor -> dependencies and only load jQuery
Browse files Browse the repository at this point in the history
jQuery is the only real dependency for most pages. Since we need to
support IE8, rather than using the 'DOMContentLoaded' event, we may
load jQuery + jQuery-UJS in <head>, and add the rest as part of the
member-facing.js bundle.
  • Loading branch information
Vincent Martinez authored and eyko committed Mar 10, 2017
1 parent 131c73c commit 58ff5c1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
2 changes: 2 additions & 0 deletions app/assets/javascripts/dependencies.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//= require jquery
//= require jquery_ujs
7 changes: 7 additions & 0 deletions app/assets/javascripts/member-facing.js.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
//= require underscore
//= require backbone
//= require sticky
//= require selectize
//= require i18n
//= require i18n/translations
//= require braintree-web
//= require shared/pub_sub
//= require shared/show_errors
//= require member-facing/registration
Expand Down
9 changes: 0 additions & 9 deletions app/assets/javascripts/vendor.js

This file was deleted.

11 changes: 4 additions & 7 deletions app/views/layouts/member_facing.slim
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,23 @@ html lang="#{@page.language.try(:code).try(:downcase)}"
meta name="description" content=t('branding.description')
- if Settings.facebook_app_id.present?
meta property='fb:app_id' content="#{Settings.facebook_app_id}"
= stylesheet_link_tag "member-facing"
= stylesheet_link_tag 'member-facing'
= stylesheet_link_tag *webpack_asset_paths('components', extension: 'css') unless Rails.env.test?

= javascript_include_tag "vendor"

= render partial: 'shared/optimizely_snippet' unless @page.optimizely_disabled?

= csrf_meta_tags
= favicon_link_tag 'images/favicon.ico'
= metamagic
- canonical_url = @page.canonical_url.blank? ? member_facing_page_url(@page) : @page.canonical_url
link rel="canonical" href=canonical_url

= javascript_include_tag 'dependencies'
= render partial: 'shared/optimizely_snippet' unless @page.optimizely_disabled?
body
= render partial: 'layouts/notification'
= yield

.mobile-indicator

= javascript_include_tag "member-facing"
= javascript_include_tag 'member-facing'
= render partial: 'shared/js_locale'
= render partial: 'shared/page_object'
= render partial: 'shared/facebook_pixel' unless Rails.env.test?
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )
Rails.application.config.assets.precompile += %w(vendor.js member-facing.css member-facing.js)
Rails.application.config.assets.precompile += %w(dependencies.js member-facing.css member-facing.js)

# to get browserify to turn everything into es6
Rails.application.config.browserify_rails.commandline_options = '--transform babelify --extension=".js"'

0 comments on commit 58ff5c1

Please sign in to comment.