#26615 closed enhancement (fixed)
Validate compiled and compressed JS using grunt
Reported by: | jorbin | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 3.9 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch |
Focuses: | Cc: |
Description
In the past we've occasionally run into issues with uglify or other minifyers. Grunt JS-Validate parses JS and thus alerts us to these occasional errors. This does add ~1 second to grunt build, but that's not so bad considering we are validating 276 javascript files.
Attachments (2)
Change History (9)
#1
@
11 years ago
- Owner set to wonderboymusic
- Resolution set to fixed
- Status changed from new to closed
#2
@
11 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
The src
checks too many files here. BUILD_DIR + '/**/*.js'
includes JS files of plugins (or other stuff in wp-content
).
Not only does this cause extra work during a grunt build
, but it can also raise errors where .js
files are used for something else (e.g. not holding JS code, but JSON data).
#3
@
11 years ago
Besides what I mentioned above, this also tries to validate JS files in npm modules of plugins in wp-content
(e.g. if they also use grunt
) -- which results in errors like
>> Line 2: Unexpected token : Validating build/wp-content/plugins/<my_plugin_slug>/node_modules/grunt-contrib-csslint/node_modules/csslint/cli.js
Thus, we should exclude wp-content
here (for which I uploaded a patch). (Drawback: Core themes would aso be exlcuded.)
Other options could be to just jsvalidate
.min.js
files (which is what this ticket was intended for, I think), although that would also check .min.js
files in plugins.
An even better solution might be to check just the files that were created by uglify
. My tries with <%= uglify.core.dest %>
failed however.
In 26977: