You might want to review http://drupal.org/project/cpn as it allows you to add custom JS and CSS for each block, node and content type.

Comments

weblitz’s picture

I've tried code per node module; it allows to put css in each block, but it doesn't seem to have an interesting functionality of Css Block Editor: this module has a token (@idblock) which can be used to get automatically the id of the block. The difference is:

CODE PER NODE css:

#block_specific_id ( I have to find by myself looking at the html source) {}

CSS BLOCK EDITOR css:

@idblock {which is always the block id}

robloach’s picture

We could easily add that feature to Code Per Node ;-) . I could help you with that if you want as I'm one of the maintainers behind the module.... We just don't want to end up with duplicate modules around, as it's one of the complaints that newcomers have when they check out Drupal. Thanks!

weblitz’s picture

ok then

I think the feature could be interesting because the code generated for a block can be copied to another block without searching for the new id

thanks

miki

robloach’s picture

Title: Difference vs CodePerNode » Provide Tokens for CSS/JavaScript IDs and Classes
Project: Css Block Editor » Code per Node
Version: » 7.x-1.x-dev
Component: Miscellaneous » Code
Category: support » feature

Let's move this over to that project then :-) .... Load in given tokens which the CSS and JS would find helpful. Like having @idblock load in for blocks, or @idnode for the node's ID.

joelstein’s picture

Instead of using the @ symbol, which has a meaning in CSS, I recommend that we use the standard token format, or something similar.

BenK’s picture

Subscribing

efc84’s picture

Hi,

Is it possible to give each individual block a custom class for the heading?

Currently i'm using Bartik and every block automatically receives a 'h2' heading and that means if i change the 'h2' colour it changes every heading to the same colour, what i want to do is change each heading into different colors, is this possible?

eg

h2.search-form-block {
color: white;
}

h2.recent-content-block {
color:blue;
}

joelstein’s picture

@efc84: I don't think your question has anything to do with Code per Node. Check out Block Class, which does what you're wanting.

efc84’s picture

Thank you joelstein