Question: I'm using a common technique to create `<STYLE>`s from within my JavaScript/jQuery - much like this

```
$('<style>.tilewidth { width:' + tilesize + 'px; height: ' + tilesize + 'px;}</style>').appendTo('head');

```

I'm doing this to control how certain objects scale (forcing `DIV`s to be square for example) - and it's working fine.

Problem is I rerun the code if the window is re sized - at which point it inserting a new set of `<STYLE>` tags after the existing ones (if someone drag-stretch/shrinks a window it could insert 100s!!)

This works, I should emphasize, because CSS only reads the last entries - but it seems clumsy and nasty and messy and untidy and horrible (it makes reading code in Firebug near impossible!!)

Question is - can I remove the old tags before inserting the new ones - or should I just force a complete page reload in re size (and if so, how - and won't it be a performance drain)?

Update: as per Robin's answer, I created a function something like this

```
function addStyle(sname,scode) {
  scode = "." + sname + " {" + scode + "}";
  if ($("#style-" + sname).length)
    $("#style-" + sname).html(scode);
  else
    $("<style/>").attr("id","style-"+sname).html(scode).appendTo("head");
}

```

Which works pretty well - thanks! :)

Answer: 
I've solved this using the following approach:

1. All jenkins projects are named after their git repository ( I use gitolite )
2. I have activated only *Trigger builds remotely* for the base builds
3. I have added a `post-receive` hook in gitolite which does something like

`$CURL --silent --netrc --insecure --connect-timeout 2 "$GIT_REMOTE_TRIGGER_URL/$GL_REPO/build?token=$JENKINS_BUILD_TOKEN" > /dev/null`
4. Scheduled all sonar jobs to poll the SCM every 24 hours
I have my regular project and a second one called "project-daily" that runs daily.

"Project" takes a parameter named "RELEASE\_TAG", which is passed as the branch specifier in the git section. The git plugin will also allow a tag to be specified here.

When "project" starts, it saves $COMMIT to a file named latest/$PROJECT.$BRANCH. ($BRANCH is set to $RELEASE\_TAG, unless $RELEASE\_TAG is a tag, in which case $BRANCH is set to "master".) This file is read by "project-daily".

"Project-daily" is a pipeline script. It does not have a repository. To save space, it runs "git clone --bare ...", and then "git log -n 1 --format=format:%H daily". It reads "latest/$PROJECT.daily" to get the latest build (attempt). If that commit is different than the "git log" output, then it calls "build job:'project'", with parameter "RELEASE\_TAG" set to "daily".

We push our working code to the daily branch. When it's time for a release build, we merge to master, tag it, and then run "project" manually with the tag (which specifies the version).