Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move scripts imports in header to webpack #10141

Merged
merged 12 commits into from
Aug 8, 2020
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
/core/templates/pages/privacy-page/privacy-page.mainpage.html @seanlip
/core/templates/pages/terms-page/ @DubeySandeep
/core/templates/pages/terms-page/terms-page.mainpage.html @seanlip
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I need to be on this one? Probably not because it hasn't got any of the actual content?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also just to check -- why is this different for the privacy vs the terms page? I.e. why is one changing but not the other?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I need to be on this one? Probably not because it hasn't got any of the actual content?

ok, removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this different for the privacy vs the terms page? I.e. why is one changing but not the other?

because terms page had jquery code. (Refer #10141 (comment))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see. OK, thanks!

/core/templates/pages/terms-page/terms-page.component.html @seanlip


# Dashboard pages.
Expand Down Expand Up @@ -535,7 +536,6 @@
/core/templates/pages/OppiaFooterDirective.ts @jameesjohn @vojtechjelinek
/core/templates/pages/footer_js_libs.html @jameesjohn @vojtechjelinek
/core/templates/pages/header_css_libs.html @jameesjohn @vojtechjelinek
/core/templates/pages/header_js_libs.html @jameesjohn @vojtechjelinek
/core/templates/services/csrf-token.service*.ts @jameesjohn @vojtechjelinek
/core/templates/third-party-imports/ @nishantwrp @vojtechjelinek
/jinja_utils*.py @jameesjohn @vojtechjelinek
Expand Down
1 change: 0 additions & 1 deletion core/templates/base-components/header.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@
<link rel="apple-touch-icon" href="/assets/images/logo/favicon.png">
<title itemprop="name"><%= title %></title>
@load('pages/header_css_libs.html')
@load('pages/header_js_libs.html')
4 changes: 3 additions & 1 deletion core/templates/pages/about-page/about-page.import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* @fileoverview Directive scripts for the about page.
*/

// The module needs to be loaded before everything else since it defines the
// Jquery needs to be loaded before anything else to make angular js work.
require('third-party-imports/jquery.import');
// The module needs to be loaded directly after jquery since it defines the
// main module the elements are attached to.
require('pages/about-page/about-page.module.ts');
require('App.ts');
Expand Down
3 changes: 3 additions & 0 deletions core/templates/pages/about-page/about-page.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import 'core-js/es7/reflect';
import 'zone.js';

import 'third-party-imports/angular-js.import';
import 'third-party-imports/headroom.import';

angular.module('oppia', [
'dndLists', 'headroom', 'infinite-scroll', 'ngAnimate',
'ngAudio', require('angular-cookies'), 'ngJoyRide', 'ngMaterial',
vojtechjelinek marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
4 changes: 3 additions & 1 deletion core/templates/pages/admin-page/admin-page.import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* @fileoverview Directives required in admin panel.
*/

// The module needs to be loaded before everything else since it defines the
// Jquery needs to be loaded before anything else to make angular js work.
require('third-party-imports/jquery.import');
// The module needs to be loaded directly after jquery since it defines the
// main module the elements are attached to.
require('pages/admin-page/admin-page.module.ts');
require('App.ts');
Expand Down
2 changes: 0 additions & 2 deletions core/templates/pages/admin-page/admin-page.mainpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
<!-- Require head styles file using webpack -->
@load('pages/header_css_libs.html')

<!-- Require head javascript file using webpack -->
@load('pages/header_js_libs.html')
</head>

<body>
Expand Down
3 changes: 3 additions & 0 deletions core/templates/pages/admin-page/admin-page.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import 'core-js/es7/reflect';
import 'zone.js';

import 'third-party-imports/angular-js.import';
import 'third-party-imports/headroom.import';

angular.module('oppia', [
'dndLists', 'headroom', 'infinite-scroll', 'ngAnimate',
'ngAudio', require('angular-cookies'), 'ngJoyRide', 'ngMaterial',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* @fileoverview Directive scripts for the classroom page.
*/

// The module needs to be loaded before everything else since it defines the
// Jquery needs to be loaded before anything else to make angular js work.
require('third-party-imports/jquery.import');
// The module needs to be loaded directly after jquery since it defines the
// main module the elements are attached to.
require('pages/classroom-page/classroom-page.module.ts');
require('App.ts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import 'core-js/es7/reflect';
import 'zone.js';

import 'third-party-imports/angular-js.import';
import 'third-party-imports/headroom.import';

angular.module('oppia', [
'dndLists', 'headroom', 'infinite-scroll', 'ngAnimate',
'ngAudio', require('angular-cookies'), 'ngJoyRide', 'ngMaterial',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* @fileoverview Directives required in collection editor.
*/

// The module needs to be loaded before everything else since it defines the
// Jquery needs to be loaded before anything else to make angular js work.
require('third-party-imports/jquery.import');
// The module needs to be loaded directly after jquery since it defines the
// main module the elements are attached to.
require('pages/collection-editor-page/collection-editor-page.module.ts');
require('App.ts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import 'core-js/es7/reflect';
import 'zone.js';

import 'third-party-imports/angular-js.import';
import 'third-party-imports/headroom.import';

angular.module('oppia', [
'dndLists', 'headroom', 'infinite-scroll', 'ngAnimate',
'ngAudio', require('angular-cookies'), 'ngJoyRide', 'ngMaterial',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* @fileoverview Directives required in collection player.
*/

// The module needs to be loaded before everything else since it defines the
// Jquery needs to be loaded before anything else to make angular js work.
require('third-party-imports/jquery.import');
// The module needs to be loaded directly after jquery since it defines the
// main module the elements are attached to.
require('pages/collection-player-page/collection-player-page.module.ts');
require('App.ts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import 'core-js/es7/reflect';
import 'zone.js';

import 'third-party-imports/angular-js.import';
import 'third-party-imports/headroom.import';

angular.module('oppia', [
'dndLists', 'headroom', 'infinite-scroll', 'ngAnimate',
'ngAudio', require('angular-cookies'), 'ngJoyRide', 'ngMaterial',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
* @fileoverview Directive scripts for the community dashboard page.
*/

// Jquery needs to be loaded before anything else to make angular js work.
require('third-party-imports/jquery.import');
// The module needs to be loaded directly after jquery since it defines the
// main module the elements are attached to.
require('pages/community-dashboard-page/community-dashboard-page.module.ts');
require('App.ts');
require('base-components/oppia-root.directive.ts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import 'core-js/es7/reflect';
import 'zone.js';

import 'third-party-imports/angular-js.import';
import 'third-party-imports/headroom.import';

angular.module('oppia', [
'dndLists', 'headroom', 'infinite-scroll', 'ngAnimate',
'ngAudio', require('angular-cookies'), 'ngJoyRide', 'ngMaterial',
Expand Down
4 changes: 3 additions & 1 deletion core/templates/pages/contact-page/contact-page.import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* @fileoverview File to import necessary scripts for contact page.
*/

// The module needs to be loaded before everything else since it defines the
// Jquery needs to be loaded before anything else to make angular js work.
require('third-party-imports/jquery.import');
// The module needs to be loaded directly after jquery since it defines the
// main module the elements are attached to.
require('pages/contact-page/contact-page.module.ts');
require('App.ts');
Expand Down
3 changes: 3 additions & 0 deletions core/templates/pages/contact-page/contact-page.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import 'core-js/es7/reflect';
import 'zone.js';

import 'third-party-imports/angular-js.import';
import 'third-party-imports/headroom.import';

angular.module('oppia', [
'dndLists', 'headroom', 'infinite-scroll', 'ngAnimate',
'ngAudio', require('angular-cookies'), 'ngJoyRide', 'ngMaterial',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* @fileoverview Directive scripts for the creator dashboard.
*/

// The module needs to be loaded before everything else since it defines the
// Jquery needs to be loaded before anything else to make angular js work.
require('third-party-imports/jquery.import');
// The module needs to be loaded directly after jquery since it defines the
// main module the elements are attached to.
require('pages/creator-dashboard-page/creator-dashboard-page.module.ts');
require('App.ts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import 'core-js/es7/reflect';
import 'zone.js';

import 'third-party-imports/angular-js.import';
import 'third-party-imports/headroom.import';

angular.module('oppia', [
'dndLists', 'headroom', 'infinite-scroll', 'ngAnimate',
'ngAudio', require('angular-cookies'), 'ngJoyRide', 'ngMaterial',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* @fileoverview File to import necessary scripts for remove-account page.
*/

// The module needs to be loaded before everything else since it defines the
// Jquery needs to be loaded before anything else to make angular js work.
require('third-party-imports/jquery.import');
// The module needs to be loaded directly after jquery since it defines the
// main module the elements are attached to.
require('./delete-account-page.module.ts');
require('App.ts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import 'core-js/es7/reflect';
import 'zone.js';

import 'third-party-imports/angular-js.import';
import 'third-party-imports/headroom.import';

angular.module('oppia', [
'dndLists', 'headroom', 'infinite-scroll', 'ngAnimate',
'ngAudio', require('angular-cookies'), 'ngJoyRide', 'ngMaterial',
Expand Down
4 changes: 3 additions & 1 deletion core/templates/pages/donate-page/donate-page.import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* @fileoverview Scripts for the donate page.
*/

// The module needs to be loaded before everything else since it defines the
// Jquery needs to be loaded before anything else to make angular js work.
require('third-party-imports/jquery.import');
// The module needs to be loaded directly after jquery since it defines the
// main module the elements are attached to.
require('pages/donate-page/donate-page.module.ts');
require('App.ts');
Expand Down
3 changes: 3 additions & 0 deletions core/templates/pages/donate-page/donate-page.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import 'core-js/es7/reflect';
import 'zone.js';

import 'third-party-imports/angular-js.import';
import 'third-party-imports/headroom.import';

angular.module('oppia', [
'headroom', require('angular-cookies'), 'ngTouch', 'ngSanitize',
'pascalprecht.translate', 'toastr', 'ui.bootstrap'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* @fileoverview Directive scripts for oppia email dashboard page.
*/

// The module needs to be loaded before everything else since it defines the
// Jquery needs to be loaded before anything else to make angular js work.
require('third-party-imports/jquery.import');
// The module needs to be loaded directly after jquery since it defines the
// main module the elements are attached to.
require('pages/email-dashboard-pages/email-dashboard-page.module.ts');
require('App.ts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import 'core-js/es7/reflect';
import 'zone.js';

import 'third-party-imports/angular-js.import';
import 'third-party-imports/headroom.import';

angular.module('oppia', [
'dndLists', 'headroom', 'infinite-scroll', 'ngAnimate',
'ngAudio', require('angular-cookies'), 'ngJoyRide', 'ngMaterial',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* @fileoverview Directive scripts for oppia email dashboard page.
*/

// The module needs to be loaded before everything else since it defines the
// Jquery needs to be loaded before anything else to make angular js work.
require('third-party-imports/jquery.import');
// The module needs to be loaded directly after jquery since it defines the
// main module the elements are attached to.
require('pages/email-dashboard-pages/email-dashboard-result.module.ts');
require('App.ts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import 'core-js/es7/reflect';
import 'zone.js';

import 'third-party-imports/angular-js.import';
import 'third-party-imports/headroom.import';

angular.module('oppia', [
'dndLists', 'headroom', 'infinite-scroll', 'ngAnimate',
'ngAudio', require('angular-cookies'), 'ngJoyRide', 'ngMaterial',
Expand Down
4 changes: 3 additions & 1 deletion core/templates/pages/error-pages/error-page.import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* @fileoverview Scripts for the error page.
*/

// The module needs to be loaded before everything else since it defines the
// Jquery needs to be loaded before anything else to make angular js work.
require('third-party-imports/jquery.import');
// The module needs to be loaded directly after jquery since it defines the
// main module the elements are attached to.
require('pages/error-pages/error-page.module.ts');
require('App.ts');
Expand Down
3 changes: 3 additions & 0 deletions core/templates/pages/error-pages/error-page.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import 'core-js/es7/reflect';
import 'zone.js';

import 'third-party-imports/angular-js.import';
import 'third-party-imports/headroom.import';

angular.module('oppia', [
'dndLists', 'headroom', 'infinite-scroll', 'ngAnimate',
'ngAudio', require('angular-cookies'), 'ngJoyRide', 'ngMaterial',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
* help tab in the navbar.
*/

// The module needs to be loaded before everything else since it defines the
// Jquery needs to be loaded before anything else to make angular js work.
require('third-party-imports/jquery.import');
// The module needs to be loaded directly after jquery since it defines the
// main module the elements are attached to.
require('pages/exploration-editor-page/exploration-editor-page.module.ts');
require('App.ts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import 'core-js/es7/reflect';
import 'zone.js';

import 'third-party-imports/angular-js.import';
import 'third-party-imports/headroom.import';

angular.module('oppia', [
'dndLists', 'headroom', 'infinite-scroll', 'ngAnimate',
'ngAudio', require('angular-cookies'), 'ngJoyRide', 'ngMaterial',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* @fileoverview Directive scripts to be used in the learner view.
*/

// The module needs to be loaded before everything else since it defines the
// Jquery needs to be loaded before anything else to make angular js work.
require('third-party-imports/jquery.import');
// The module needs to be loaded directly after jquery since it defines the
// main module the elements are attached to.
require('pages/exploration-player-page/exploration-player-page.module.ts');
require('App.ts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import 'core-js/es7/reflect';
import 'zone.js';

import 'third-party-imports/angular-js.import';
import 'third-party-imports/headroom.import';

angular.module('oppia', [
'dndLists', 'headroom', 'infinite-scroll', 'ngAnimate',
'ngAudio', require('angular-cookies'), 'ngJoyRide', 'ngMaterial',
Expand Down
12 changes: 6 additions & 6 deletions core/templates/pages/footer_js_libs.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
@load('base-components/no-script.template.html')

<% if (webpackConfig.mode == 'production') { %>
<script src="/third_party/generated/js/third_party.min.js"></script>
<% } else { %>
<script src="/third_party/generated/js/third_party.js"></script>
<% } %>

<!-- This code is used for inserting webpack bundles
https://github.com/jantimon/html-webpack-plugin#writing-your-own-templates -->
<% for (var chunk in htmlWebpackPlugin.files.js) { %>
Expand All @@ -15,3 +9,9 @@
<script src="/webpack_bundles/<%= htmlWebpackPlugin.files.js[chunk] %>"></script>
<% } %>
<% } %>

<% if (webpackConfig.mode == 'production') { %>
<script src="/third_party/generated/js/third_party.min.js"></script>
<% } else { %>
<script src="/third_party/generated/js/third_party.js"></script>
<% } %>
vojtechjelinek marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* @fileoverview File to import necessary scripts for get_started page.
*/

// The module needs to be loaded before everything else since it defines the
// Jquery needs to be loaded before anything else to make angular js work.
require('third-party-imports/jquery.import');
// The module needs to be loaded directly after jquery since it defines the
// main module the elements are attached to.
require('pages/get-started-page/get-started-page.module.ts');
require('App.ts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import 'core-js/es7/reflect';
import 'zone.js';

import 'third-party-imports/angular-js.import';
import 'third-party-imports/headroom.import';

angular.module('oppia', [
'dndLists', 'headroom', 'infinite-scroll', 'ngAnimate',
'ngAudio', require('angular-cookies'), 'ngJoyRide', 'ngMaterial',
Expand Down
Loading