There are many advantages to creating a CSS file for each node, rather than using the somewhat hackish way of embedding the CSS inline. The attached patch stores a file in the "css_css" folder under the file system path (e.g., "sites/default/files/css_css/59.css"). It writes files for all existing nodes with custom CSS. Lastly, it serves up the actual file rather than pointing to "css/get/59".

Comments

joelstein’s picture

StatusFileSize
new373 bytes
new3.31 KB

Oops, the patches didn't get uploaded.

joelstein’s picture

For what it's worth, I created a module which adds this plus much more (including Javascript support) here: Code per Node.

fax8’s picture

Hi there, thanks for your patches. Is usually a good idea not to create another module when there are already which somehow does the same as your would do but rather collaborate and improve what is already available.

I saw you already went with creating your Code per Node.. but would you be interested in moving those features to CSS module?

joelstein’s picture

Well, in addition to CSS support, Code per Node adds Javascript support. And, not just for nodes, but for blocks as well (as soon as I commit this patch: #1017738: Code per Node for blocks). I was really close to making a patch for the CSS module, but wanted a solution which handled CSS and Javascript, and since your module's name is "CSS", it didn't seem to try and cram Javascript into that name.