Skip to content
Grav 2.0 is officially stable. Read the announcement →
Plugins

Where can I find the source for plugins/admin/themes/grav/js/admin.min.js?

Solved by pamtbaau View solution

Started by Anna 5 years ago · 5 replies · 719 views
5 years ago

I want to do some javascript stuff with the CodeMirror editor in Admin. I would love to take a good look at what's in there already, and as far as I can see all the code is in user/plugins/admin/themes/grav/js/admin.min.js. But that file is minified and almost 2 MB in size… the minification being the bigger problem.

Can somebody maybe tell me where all that code comes from? It's not just the CodeMirror stuff I think…? That would be super helpful :-)

5 years ago

@Netzhexe, If you open file user/plugins/admin/themes/grav/js/admin.min.js you will find the names of 79 files on which the webpack bundle has been build upon.

To name a few:

TXT
"./app/dashboard/backup.js"
"./app/dashboard/cache.js"
"./app/dashboard/chart.js"
"./app/dashboard/index.js"
"./app/forms/fields/acl-picker.js"
"./app/forms/fields/array.js"
"./app/forms/fields/collections.js"
...

By the way, webpack is an asset bundler...

At its core, webpack is a static module bundler for modern JavaScript applications. When webpack processes your application, it internally builds a dependency graph which maps every module your project needs and generates one or more bundles .

last edited 04/20/21 by pamtbaau
5 years ago

Ah, my most consistent saviour…! :upside_down_face: Thank you for your reply. I admit I did not open that file because I checked it out on Github, and it was too big to display online, and so I thought it would be minified and hard to read anyway. However, I just looked and I actually don't find any of those paths you mentioned, anywhere in the file. Just a loooooooooong line of minified javascript. Am I looking at the wrong version or something…?

5 years ago Solution

@Netzhexe, Here are the first 16 unaltered lines of file user/plugins/admin/themes/grav/js/admin.min.js, showing a reference to ./app/dashboard/backup.js:

MARKDOWN
/*
 * ATTENTION: An "eval-source-map" devtool has been used.
 * This devtool is not neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
var Grav;Grav =
/******/ (() => { // webpackBootstrap
/******/    var __webpack_modules__ = ({

/***/ "./app/dashboard/backup.js":
/*!*********************************!*
  !*** ./app/dashboard/backup.js ***!
  \*********************************/

By the way, its contents may look minified, but it isn't...

last edited 04/20/21 by pamtbaau
5 years ago

Heh. I actually did have an outdated version (Grav 1.7.0-something, and Admin around that date). I just updated and now the file looks so much nicer thank youuuuuu!

5 years ago

@Netzhexe, FYI, I've logged an issue because the Admin javascript libraries have been bundled with mode 'development' instead of 'production'. That's what makes the libs so large...

Oh and btw, also large files can be opened on Github, if you choose 'raw'

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 75 1 week ago
Plugins · by Xavier, 4 weeks ago
2 81 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1208 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 75 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 99 2 months ago