I'm going to start porting this to D7 today. I'll post a patch here when I have it working.

Comments

fax8’s picture

Great! That would be great! Please note that currently the CVS version tagged as HEAD is actually older than the one available as6.x-dev version.. You should start porting from 6.x-dev rather than HEAD.

If you would need help at any time please feel free to ask for help and I'll be glad to give it to you.

Fabio Varesano

sreynen’s picture

Assigned: sreynen » Unassigned
Status: Active » Needs review
StatusFileSize
new14.36 KB

I'm attaching a patch against HEAD that works in D7. It's almost a complete rewrite, using the new field API to attach the CSS. Because fields can be used anywhere in D7, this makes the css/get callback a bit more complicated, but it removes the need for the whole css.install file.

sreynen’s picture

Oops. I didn't see your note about porting from 6.x-dev until just now. I can go back and change it if that's a problem.

fax8’s picture

StatusFileSize
new5.64 KB

I attach here the diff between current HEAD and current 6.x-dev ... Most of the changes are code cleaning, comments but there have been also some bugs so have a look at it so you can integrate with your code. I'll be reviewing your patch anyway so don't worry if you forget something.

lelizondo’s picture

I just noticed that in the front page of this module says: "I pledge the Video module...".

fax8’s picture

Thanks for pointing that out... fixed.

sreynen’s picture

Status: Needs review » Needs work

I just discovered this doesn't work with CSS caching on. I believe the issue is that caching assumes an actual file to cache, but this just outputs the CSS at a menu callback. I changed it to add the CSS as type=external, which fixed it, but that feels like a bit of a hack. I didn't find any way to prevent an internal CSS path from being included in the cache.

damienmckenna’s picture

Going to give this a try for a project that wants to be able to do this, thanks for the work so far.

damienmckenna’s picture

StatusFileSize
new18.04 KB

Here's a new patch that:

  • Improves on sreyen's patch in #2,
  • Moves the author comments to the README.txt file,
  • Tidies up some minor formatting issues, line truncating lines with comments to 80 characters,
  • Adds lots of additional IF statements to help prevent errors,
  • Wraps the output CSS in filter_xss() for some limited security benefit,
  • Fixes other small some bugs so that it all works correctly, even when CSS aggregation is enabled.

This seems to work for me and should be ready for use as the start of the D7 branch.

damienmckenna’s picture

StatusFileSize
new9.02 KB

Here's an archive of the fully working version.

fax8’s picture

Thank you. I'll give it a try in the next couple of days.

jeffwidman’s picture

subscribe

sreynen’s picture

Status: Needs work » Reviewed & tested by the community

This is ready to create a new branch.

fax8’s picture

Sorry guys, I've been quite busy lately.. I'll try committing a D7 version soon. Thanks!

jens peter’s picture

#D7CX: I pledge that CSS Module will have a full Drupal 7 release on the day that Drupal 7 is released.
Guess that was incorrect and that a pledge really do not mean much.
I understand that most of this is done often on peoples free time and that if we get busy we might need to focus on other things first.
But I dont understand why adding something to a module that is simply not true is needed. Keep it simple for us all and dont pledge anything unless one at least will try... Drupal 7 have been out for a very long time now.

fax8’s picture

Come on dude. We had working code for D7 for more than one year now.. not a full release but you can use CSS module without problems on D7.

I think complaining it's usually easier than coding and testing.

Crell’s picture

Code sitting in an issue does not a release make. I didn't make a D7CX pledge for my modules because I didn't know if I would be able to follow-through. Calling out a module maintainer for taking the pledge and then not doing so is not inappropriate. At the very least by now a dev release could have been made.

fax8’s picture

Crell, you are now a co-maintainer.. I hope you could help pushing out a release. Thanks!

sreynen’s picture

For anyone waiting on this functionality in D7, it looks like Code Per Node does everything CSS does and more with a stable D7 release. This might actually be a good opportunity to reduce the duplicate functionality here by not doing a D7 release of CSS at all.

damienmckenna’s picture

As someone who put effort into the patch and got it working, I'd also vote for discontinuing this module in favor of CPN, as mentioned by @sreynen.

fax8’s picture

I think I do agree with you guys on moving to Code Per Node. Anyone has ideas on the migration path?

sreynen’s picture

fax8, by "migration path" do you mean for users, or for site data? For users, I think the standard approach is just a link on the project page. Typekit is the first example that comes to mind for me, but I think I've seen quite a few like that recently with the D7 transition. For site data, I can't think of an example where I've seen data migration between modules.

Crell’s picture

I'm pretty sure by migration he means the user data. Given that the data we're dealing with is not particularly complex, I don't think the migration would be THAT difficult. We'd need a 7.x version of this module that contains pretty much nothing but the update hooks and a new dependency on the module we're folding data into.

lelizondo’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

I'm not 100% sure but I think Content Profile is an example of data migration between modules. Anyway, that's not the important point here, the point is if it's possible to create a data migration module or not and if we're willing to work in it.

fax8’s picture

Title: Drupal 7 version » D7: moving CSS data to Code Per Node
Status: Closed (won't fix) » Active

I'll try creating an ad hoc d7 version as suggested in #23. Let me know if someone has suggestions.

geerlingguy’s picture

This post might be of some assistance to people looking into this issue: Migrating style and script tags from node bodies into Code per Node.