Hi davebv,

What you have there is pretty good already. Now, to avoid loading many CSS in each page, would you consider adding some selection support based on node types and on individual pages?

I think we could achieve that with a very simple scheme that adds a directory tree under the existing folder.

customercssjs/css/node-type/extra-css-for-node-type*.css
customercssjs/css/node-id/extra-css-for-page-id*.css

If the folder exists and it matches the current node type, and node identifier, then include those extra CSS.

It seems to me that this scheme would not break your existing behavior (unless you read all the files, including those in sub-folders already?!)

Please, let me know your thoughts.

Thank you.
Alexis Wilke

Comments

davebv’s picture

Hi,

Thanks for the suggestion, that would be a good scheme to add styles and js based on content type or id.

What do you think about having all the files listed in admin pages and then select where to include? (Just thinking out loud as an alternative)

AlexisWilke’s picture

Dave,

Well... if you have half a million nodes, that would be a large page... 8-)

The way I mentioned it would be automatic and thus maybe a bit hard for some users to know where things are going. Although, for the CSS files, it is already like that with all those .tpl name which I still don't master.

I have a website (Scam Page of Alexis) where some of the pages should keep the CSS from the original message. (luckily, not that often!) So whenever I edit a page, I'd like to specify the CSS for that one page. The best would actually be to have an extra box where I can just paste the CSS. Then that CSS is added to the output page (possibly just inline would work for me! and it could be before or after the theme, no matter since the node data will include a special DIV with an ID which I can use for the theming.)

Now, it would be just fine and very simple for me to create a folder for that node and voilà!

Thank you.
Alexis