-
Notifications
You must be signed in to change notification settings - Fork 0
Package shared Javascript with yarn and webpack #44
Conversation
In regards to your statement on |
Thanks, @tjdo, I will try that out! |
@@ -16,7 +16,7 @@ UI.load -> | |||
initialVal = null | |||
|
|||
if $(datepicker).val().length | |||
initialVal = moment($(datepicker).val()).format('MM/DD/YYYY h:mm A') | |||
initialVal = moment(new Date($(datepicker).val())).format('MM/DD/YYYY h:mm A') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To quiet a warning
app/javascripts/app/filters.coffee
Outdated
@@ -1,7 +1,6 @@ | |||
updateFilters = -> | |||
if $('#filter-bar').exists() | |||
$("#filter-bar").stick_in_parent(parent: '#main', offset_top: 88) | |||
$(document.body).trigger("sticky_kit:recalc") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will investigate recovering this. Not sure what it was removed.
app/javascripts/app/nav.coffee
Outdated
# =================================================== | ||
|
||
UI.load -> | ||
$("#subnav.sticky-subnav").stick_in_parent(bottoming: false, offset_top: $('#nav').height()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will investigate
|
||
$.fn.enable = -> | ||
this.each -> | ||
$(this).prop('disabled', false) | ||
$(this).removeClass('disabled').prop('disabled', false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convenience for Engage. I don't think this will any downstream effects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont see any downstream effects with this either
hideLoadingSpinner() | ||
# TODO commented out with webpack conversion | ||
# $(window).unload -> | ||
# hideLoadingSpinner() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will investigate re-adding.
@techvalidate/engineering For your consideration. Feedback welcome. This change enables the refactor at techvalidate/engage#451
This PR begins the process of converting our Javascript asset pipeline to webpack. There does not seem to be a current path forward with engines and webpack, as of rails/webpacker#21
My original thought was to spin up another pano-js repository to cleanly separate our shared ruby and js. However, I feel like we're already juggling too much will multiple production version of Pano and adding yet another repo seems like it would further complicate matters.
The Changes
Rails convention is to store webpack'd files in
app/javascripts
, notapp/assets/javascripts
Since the asset pipeline is not building the
require
load order, those calls are unnecessary.UI
is now exported and loaded on the window via ProvidedPluginDependencies are loaded via package.json
Statements of Value
I still believe in coffeescript! Given the sprinkle nature of the majority of our js (especially
UI
), I have not found a situation wherein coffeescript does not provide a more concise solution to the problems we are trying to solve.Given the breadth and depth of our discussions around Javascript, I expect this will be a controversial position. I am open to any code examples you feel my sway me. As always: strong opinions, weakly held.
To Be Investigated
The
main
attribute in package.json allows for easy bundling of the global js. Any way to apply this to namespaces?Any way to simplify global loading with ProvidedPlugin in shared.js?
I have not found an equivalent of
require_tree
What about CSS from dependencies? Do we need it, and if so, how do we reference it?