This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
js: splitted into bundles and chunks
Initially we had one single entrypoint that generated one large output file. The idea of this patch was to split unecessary code into different entrypoints (authenticated and unauthenticated) and split vendors files into a different chunk. Now it produces smaller bundles and chunks that will be downloaded asynchronously and increase the speed up of pages the first time. Also removed unused and uncessary code from lifeitup vendor file. Signed-off-by: Vítor Avelino <[email protected]>
- Loading branch information
Vítor Avelino
committed
Aug 3, 2018
1 parent
004cd69
commit 82199e9
Showing
10 changed files
with
224 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,47 @@ | ||
jQuery(function ($) { | ||
$('a[rel~=popover], .has-popover').popover(); | ||
$('a[rel~=tooltip], .has-tooltip').tooltip(); | ||
import Vue from 'vue'; | ||
|
||
import dayjs from 'dayjs'; | ||
import relativeTime from 'dayjs/plugin/relativeTime'; | ||
|
||
import Alert from './shared/components/alert'; | ||
|
||
import { setTimeOutAlertDelay, refreshFloatAlertPosition } from './utils/effects'; | ||
|
||
dayjs.extend(relativeTime); | ||
|
||
$(function () { | ||
if ($.fn.popover) { | ||
$('a[rel~=popover], .has-popover').popover(); | ||
} | ||
|
||
if ($.fn.tooltip) { | ||
$('a[rel~=tooltip], .has-tooltip').tooltip(); | ||
} | ||
|
||
// process scheduled alerts | ||
Alert.$process(); | ||
|
||
refreshFloatAlertPosition(); | ||
|
||
// disable effects during tests | ||
$.fx.off = $('body').data('disable-effects'); | ||
}); | ||
|
||
// necessary to be compatible with the js rendered | ||
// on the server-side via jquery-ujs | ||
window.setTimeOutAlertDelay = setTimeOutAlertDelay; | ||
window.refreshFloatAlertPosition = refreshFloatAlertPosition; | ||
|
||
// we are not a SPA and when user clicks on back/forward | ||
// we want the page to be fully reloaded to take advantage of | ||
// the url query params state | ||
window.onpopstate = function (e) { | ||
// phantomjs seems to trigger an oppopstate event | ||
// when visiting pages, e.state is always null and | ||
// in our component we set an empty string | ||
if (e.state !== null) { | ||
window.location.reload(); | ||
} | ||
}; | ||
|
||
Vue.config.productionTip = process.env.NODE_ENV !== 'production'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import UsersSignUpPage from './pages/sign-up'; | ||
import UsersSignInPage from './pages/sign-in'; | ||
|
||
const USERS_SIGN_IN_ROUTE = 'auth/sessions/new'; | ||
const USERS_SIGN_UP_ROUTE = 'auth/registrations/new'; | ||
|
||
$(() => { | ||
const $body = $('body'); | ||
const route = $body.data('route'); | ||
|
||
if (route === USERS_SIGN_UP_ROUTE) { | ||
// eslint-disable-next-line | ||
new UsersSignUpPage($body); | ||
} | ||
|
||
if (route === USERS_SIGN_IN_ROUTE) { | ||
// eslint-disable-next-line | ||
new UsersSignInPage($body); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
// Bootstrap | ||
import 'bootstrap/js/tooltip'; | ||
|
||
// misc | ||
import './polyfill'; | ||
|
||
// modules | ||
import './modules/explore'; | ||
import './modules/users/unauthenticated'; | ||
|
||
import './bootstrap'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.