From 9b11413d14e5a151d14bfa72765f105ed3ebcb86 Mon Sep 17 00:00:00 2001
From: Peter Jaszkowiak
Date: Mon, 27 Nov 2017 10:42:10 -0700
Subject: [PATCH] Bundle admin scripts, remove CDN scripts (#6122)
Close #6120
---
install/package.json | 1 +
public/vendor/jquery/sortable/Sortable.js | 15 +--------------
src/meta/js.js | 19 +++++++++++++++++--
src/views/admin/header.tpl | 10 ----------
4 files changed, 19 insertions(+), 26 deletions(-)
diff --git a/install/package.json b/install/package.json
index 0ebb881886..83871adc3b 100644
--- a/install/package.json
+++ b/install/package.json
@@ -52,6 +52,7 @@
"lodash": "^4.17.4",
"logrotate-stream": "^0.2.5",
"lru-cache": "4.1.1",
+ "material-design-lite": "^1.3.0",
"mime": "^2.0.3",
"mkdirp": "^0.5.1",
"mongodb": "2.2.33",
diff --git a/public/vendor/jquery/sortable/Sortable.js b/public/vendor/jquery/sortable/Sortable.js
index cf0b5f047b..8835d14375 100644
--- a/public/vendor/jquery/sortable/Sortable.js
+++ b/public/vendor/jquery/sortable/Sortable.js
@@ -7,20 +7,7 @@
(function (factory) {
"use strict";
-
- if (typeof define === "function" && define.amd) {
- define(factory);
- }
- else if (typeof module != "undefined" && typeof module.exports != "undefined") {
- module.exports = factory();
- }
- else if (typeof Package !== "undefined") {
- Sortable = factory(); // export for Meteor.js
- }
- else {
- /* jshint sub:true */
- window["Sortable"] = factory();
- }
+ window.Sortable = factory();
})(function () {
"use strict";
diff --git a/src/meta/js.js b/src/meta/js.js
index cac47834be..e3c988736b 100644
--- a/src/meta/js.js
+++ b/src/meta/js.js
@@ -76,6 +76,19 @@ JS.scripts = {
'public/src/modules/storage.js',
],
+ admin: [
+ 'node_modules/material-design-lite/material.js',
+ 'public/vendor/jquery/sortable/Sortable.js',
+ 'public/vendor/colorpicker/colorpicker.js',
+ 'public/src/admin/admin.js',
+ 'public/vendor/semver/semver.browser.js',
+ 'public/vendor/jquery/serializeObject/jquery.ba-serializeobject.min.js',
+ 'public/vendor/jquery/deserialize/jquery.deserialize.min.js',
+ 'public/vendor/snackbar/snackbar.min.js',
+ 'public/vendor/slideout/slideout.min.js',
+ 'public/vendor/nprogress.min.js',
+ ],
+
// modules listed below are built (/src/modules) so they can be defined anonymously
modules: {
'Chart.js': 'node_modules/chart.js/dist/Chart.min.js',
@@ -299,13 +312,15 @@ function getBundleScriptList(target, callback) {
return callback(err);
}
- var scripts = JS.scripts.base.concat(pluginScripts);
+ var scripts = JS.scripts.base;
if (target === 'client' && global.env !== 'development') {
scripts = scripts.concat(JS.scripts.rjs);
+ } else if (target === 'acp') {
+ scripts = scripts.concat(JS.scripts.admin);
}
- scripts = scripts.map(function (script) {
+ scripts = scripts.concat(pluginScripts).map(function (script) {
var srcPath = path.resolve(basePath, script).replace(/\\/g, '/');
return {
srcPath: srcPath,
diff --git a/src/views/admin/header.tpl b/src/views/admin/header.tpl
index 735dbd7264..d6eba4b640 100644
--- a/src/views/admin/header.tpl
+++ b/src/views/admin/header.tpl
@@ -19,17 +19,7 @@
};
-
-
-
-
-
-
-
-
-
-