The current trend in Drupal core modules is to place CSS and JS files into their own subdirectories.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jessebeach’s picture

Status: Active » Needs review
Issue tags: +code cleanup
FileSize
21.3 KB

This patch moves the .js file under a js/ directory and the css files under a css/ directory.

No code changes other than file reference paths were made.

Wim Leers’s picture

Title: Reorganize contextual module's CSS and JS assets into their own subdirectories » Reorganize contextual module's JS assets into their own subdirectories
Issue tags: +Spark
FileSize
1.83 KB

The CSS assets are already in their own directory.

This patch moves the JS assets into its own directory.

jessebeach’s picture

Once small comment update to reflect the new location of contextual.toolbar.js.

Otherwise the patch looks good. I manually verified the changes on a fresh install.

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +quickfix

Good catch!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 1454b2e and pushed to 8.x. Thanks!

This patch could have been tons smaller if git is configured with renames = copies see https://drupal.org/documentation/git/configure

here is the total patch for me :)

diff --git a/core/modules/contextual/contextual.module b/core/modules/contextual/contextual.module
index ed0066b..6c2f43f 100644
--- a/core/modules/contextual/contextual.module
+++ b/core/modules/contextual/contextual.module
@@ -109,8 +109,8 @@ function contextual_library_info() {
     'version' => VERSION,
     'js' => array(
       // Add the JavaScript, with a group and weight such that it will run
-      // before modules/contextual/contextual.toolbar.js.
-      $path . '/contextual.js' => array('group' => JS_LIBRARY, 'weight' => -2),
+      // before modules/contextual/js/contextual.toolbar.js.
+      $path . '/js/contextual.js' => array('group' => JS_LIBRARY, 'weight' => -2),
     ),
     'css' => array(
       $path . '/css/contextual.module.css' => array(),
@@ -132,7 +132,7 @@ function contextual_library_info() {
     'js' => array(
       // Add the JavaScript, with a group and weight such that it will run
       // before modules/overlay/overlay-parent.js.
-      $path . '/contextual.toolbar.js' => array('group' => JS_LIBRARY, 'weight' => -1),
+      $path . '/js/contextual.toolbar.js' => array('group' => JS_LIBRARY, 'weight' => -1),
     ),
     'css' => array(
       $path . '/css/contextual.toolbar.css' => array(),
diff --git a/core/modules/contextual/contextual.js b/core/modules/contextual/js/contextual.js
similarity index 100%
rename from core/modules/contextual/contextual.js
rename to core/modules/contextual/js/contextual.js
diff --git a/core/modules/contextual/contextual.toolbar.js b/core/modules/contextual/js/contextual.toolbar.js
similarity index 100%
rename from core/modules/contextual/contextual.toolbar.js
rename to core/modules/contextual/js/contextual.toolbar.js
Wim Leers’s picture

Alex: indeed :) I did that too in #2. Adding the --find-renames parameter when diffing works too :)

jessebeach’s picture

This patch could have been tons smaller if git is configured with renames = copies

Noted! I made the config changes to my setup.

Automatically closed -- issue fixed for 2 weeks with no activity.