We include CSS Injector in https://www.drupal.org/project/cm_starterkit_easy. The module has been a great way for users who know a little CSS, but aren't comfortable creating their own sub theme or using git to make changes.

After identifying the root cause of #2328701: Update to CSS Injector 2.x After Testing 2.x and Upgrade from 1.x to 2.x is Complete and opening issue with Pantheon support and CSS Injector (to warn users about the issue), I started looking at why the CSS values weren't stored in the database. Several years ago I did a quick and dirty port of css_injector to start the D7 1.x branch of the CSS Injector for #1018156: Port JS injector module to drupal 7 so I was somewhat familiar with the codebase.

@wiifm did a rewrite of JS Injector for the 2.x branch that leveraged CTools for exports. As result, JS Injectors can be captured in Features as well. I've now forked js_injector back to css_injector.

I've read #2158951: [META] CSS Injector 7.x-2.x roadmap and #2160675: [META] Testing Coverage and refactoring of css_injector. I have to question whether that was a case of perfection preventing progress?

This version of css_injector solves most of the issues in the 2.x roadmap. I'm including it as a zip and a patch. The patch replaces every line of every file. The .zip of the module is already fully functional, but has no upgrade hook from 1.x -> 2.x yet. This isn't an issue for the specific client who is already testing this because they already lost all of their custom CSS :(.

This version includes several improvements over 1.x including:

  • Feature Support (which provides some revision control)
  • Support for file level editing in the [FEATURE].css_injector_rules.inc file (I know this isn't as clean, but it there are benefits)
  • Import/Export Injectors directly from UI (quickly deploy changes between sites)
  • Target CSS to type of Media (All, Print, Screen, etc)
  • Option to Disable Specific Injectors (without deleting them)

I did not include the ace.js file as that is both a violation of the Drupal.org Policy for 3rd Party Libraries and Content and not something I'm familiar with. If there is demand for Ace support, the 3rd party libraries should be added using Libraries like it is in http://cgit.drupalcode.org/ace_editor/tree/README.txt?id=refs/heads;id2=...

I need this to work for clients using Pantheon, so I'm willing to start and co-maintain the 2.x branch if you'll grant me access. I'm looking for feedback on this version to see if there are use cases this approach doesn't work for.

CommentFileSizeAuthor
#1 2329285-complete-rewrite.patch726.42 KBkreynen
css_injector.zip260.75 KBkreynen
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kreynen’s picture

FileSize
726.42 KB

  • kreynen committed 5a3325d on 7.x-2.x
    restarting 2.x updates as defined in #2329285
    
kreynen’s picture

Title: Starting CSS Injector 2.x » Restarting CSS Injector 2.x as fork of JS Injector 2.x
Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Active » Needs review

This now exists as a dev snapshot, but there is not update hook from 1.x to 2.x. Upgrading currently requires reconfiguring.

Status: Needs review » Needs work

The last submitted patch, 1: 2329285-complete-rewrite.patch, failed testing.

  • kreynen committed a219abd on 7.x-2.x
    includes 3 update hook to get from 1.x to 2.x including importing .css...
kreynen’s picture

Title: Restarting CSS Injector 2.x as fork of JS Injector 2.x » Restart CSS Injector 2.x as fork of JS Injector 2.x
Assigned: Unassigned » kreynen
Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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