-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Upgrade CodeMirror to latest v5 #10778
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
Changes from 20 commits
aaf2ccb
7ac44f9
e192eaf
4c7295d
0a0d960
ac581bc
2fb47e4
3fb2281
79295b3
404c7fa
0dcbf28
f96389f
10ce369
5d691d0
6f83bcf
3928682
39a8bfe
1802d4d
a5858ec
6dce922
5378ec6
d5ffce2
1535b0c
ee2b6bd
744f1c3
cf742fa
7db8792
3d58f09
6bc559f
ee0d1ec
a744d10
676b088
d3d5a56
1b15d2c
a88a606
2263035
b48e38a
90551e7
09e7731
fc23471
534b297
3048f37
c0edfab
f108a38
f6d43d6
807b691
61afe75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,10 +1,12 @@ | ||||||||||
| /* jshint node:true */ | ||||||||||
| /* jshint esversion: 6 */ | ||||||||||
| /* eslint-env es6 */ | ||||||||||
| /* globals Set */ | ||||||||||
| var webpackConfig = require( './webpack.config' ); | ||||||||||
| var installChanged = require( 'install-changed' ); | ||||||||||
|
|
||||||||||
| module.exports = function(grunt) { | ||||||||||
| var pkg = grunt.file.readJSON( 'package.json' ); | ||||||||||
| var path = require('path'), | ||||||||||
| fs = require( 'fs' ), | ||||||||||
| glob = require( 'glob' ), | ||||||||||
|
|
@@ -175,6 +177,27 @@ module.exports = function(grunt) { | |||||||||
| banner: BANNER_TEXT, | ||||||||||
| linebreak: true | ||||||||||
| }, | ||||||||||
| codemirror: { | ||||||||||
| options: { | ||||||||||
| linebreak: false, | ||||||||||
| banner: `/*! This file is auto-generated from CodeMirror - v${ pkg.dependencies.codemirror }\n` + | ||||||||||
| `\n` + | ||||||||||
| `CodeMirror, copyright (c) by Marijn Haverbeke and others\n` + | ||||||||||
| `Distributed under an MIT license: http://codemirror.net/LICENSE\n` + | ||||||||||
| `\n` + | ||||||||||
| `This is CodeMirror (http://codemirror.net), a code editor\n` + | ||||||||||
| `implemented in JavaScript on top of the browser's DOM.\n` + | ||||||||||
| `\n` + | ||||||||||
| `You can find some technical background for some of the code below\n` + | ||||||||||
| `at http://marijnhaverbeke.nl/blog/#cm-internals .\n` + | ||||||||||
| `*/` | ||||||||||
| }, | ||||||||||
| files: { | ||||||||||
| src: [ | ||||||||||
| WORKING_DIR + 'wp-includes/js/codemirror/codemirror.min.css' | ||||||||||
| ] | ||||||||||
|
Comment on lines
+185
to
+187
|
||||||||||
| src: [ | |
| WORKING_DIR + 'wp-includes/js/codemirror/codemirror.min.css' | |
| ] | |
| src: [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in cf742fa.
Gemini's reasoning:
The problem solved is a task execution conflict that would occur during a full production build (
grunt build).In Grunt, if you invoke a task without a specific target (e.g., calling
'usebanner'instead of'usebanner:files'), it automatically tries to run all defined targets for that task.In your
Gruntfile.js,usebannerhas two targets:
files: Handles general WordPress Core CSS/JS.codemirror: Handles the specific CodeMirror CSS bundle.The
build:csstask (which is part of the main Core build) was calling the generic'usebanner'. This meant that every time someone ran a standard CSS build, Grunt would try to add a banner towp-includes/js/codemirror/codemirror.min.css.However, that CodeMirror file is not created until the
build:codemirrortask runs later. This would cause Grunt to throw a "File not found" warning or error during the general CSS build phase.By explicitly calling
'usebanner:files'inbuild:css, we ensure that the general build only touches general files, and the CodeMirror banner is handled only when CodeMirror itself is actually being built.
Uh oh!
There was an error while loading. Please reload this page.