Script.js is minified. How should I find the module responsible for this?
-
10-10-2020 - |
Question
I've inherited code for a project, Magento 1.9. For the task at hand, I need to touch a JavaScript file located at
skin/frontend/my_projects_name/default/release/js/script.js
This script was originally minified. To make changes, because I don't know how it was minified, I've used a program to "un-minify" it manually. Is this file common among Magento 1.9 projects, or is it unique to this codebase? There are several JS files. Which file was this minified from?
In the skin/frontend/my_projects_name/default
dir, there are multiple dependencies files:
- bower.json
- Gruntfile.js
- gulpfile.js
- package.json
Solution 3
It turns out to be unique to my codebase indeed. There was a "gulp" script (see gulp.js), which compiles stylesheets and script files. In order to make JS changes, I needed to run
gulp watch
similar to a scss compiler.
OTHER TIPS
The easiest way to find the original JS file it to go to your server on the command line and use grep
to find the line, not the most beautiful solution, but it get's the job done:
grep -r 'your statement' *
This sounds like it's unique to your codebase as I haven't ever seen a directory called release
inside the skin directory. Nor do any of our M1 projects have scripts.js
in the themes scripts directory (except the enterprise default theme).
Unless it's referring to this file and the release
directory is a symlink that changes on each release?
skin/frontend/enterprise/default/js/scripts.js
If this is the case it's responsible for some enterprise features.
To see if this is the case check the first few lines after the comments (line 27 and 28), do they look like this?
Validation.defaultOptions.immediate = true;
Validation.defaultOptions.addClassNameToContainer = true;