HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

trouble implementing function RemoveCssFile() with theme css in a plugin.

I tried to remove a particular stylesheet via RemoveCssFile, with no success.
It seems to remove ones that were added via the plugin.

but within a plugin it won't remove an application theme css.

public function Base_Render_Before($Sender) {

all of the following
$Sender->RemoveCssFile("custom.css") 
$Sender->RemoveCssFile("vanilla/themes/mobile/design/custom.css")
$Sender->RemoveCssFile("/vanilla/themes/mobile/design/custom.css")
$Sender->RemoveCssFile("themes/mobile/design/custom.css")
$Sender->RemoveCssFile("/themes/mobile/design/custom.css")
$Sender->RemoveCssFile("http:example.com/vanilla/themes/mobile/design/custom.css")
$Sender->RemoveCssFile("http:example.com/vanilla/themes/mobile/design/custom.css?v=1.1.1")
$Sender->RemoveCssFile("var/www/vanilla/themes/mobile/design/custom.css")
$Sender->RemoveCssFile("var/www/vanilla/themes/mobile/design/custom.css?v=1.1.1")

and with a few other events.

The only way I could remove it was via js. But it would probably be better if it worked with php.
Any ideas how to remove the themes/mobile/design/custom.css from within a plugin via RemoveCssFile() or with another php function.

on a side note - it seems that $this->GetResource('examplefile.css', FALSE, TRUE) called from a plugin will not really do an absolute call it is always relative to the plugin path. And I thought the second variable makes it absolute instead of relative.

I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Comments

  • Options

    @Lincoln or @Todd - if you ever want to explain the ins and outs of this one - feel free to answer.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    ToddTodd Chief Product Officer Vanilla Staff

    Yeah, the custom.css is actually included after Base_Render_Before so you are removing it too soon. The first function calls ($Sender->RemoveCssFile('custom.css') is the correct format though.

  • Options
    peregrineperegrine MVP
    edited December 2012

    thx. I I ever find a suitable event to trigger off of I'll post it.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    LincLinc Detroit Admin

    My new IDE added tabs instead of spaces. I am so ashamed. :(

  • Options
    ToddTodd Chief Product Officer Vanilla Staff

    Just as a note for 2.1 removing css files is not advisable. We are moving towards having all css files combined into one and cherry-picking out css files for a particular request is not advisable. You are basically giving up on the ability to speed up the entire site just to remove one file.

    Is there another way you can think of your problem?

  • Options
    peregrineperegrine MVP
    edited December 2012

    Is there another way you can think of your problem?

    Perhaps :).

    from the kung fu tv series:
    Caine: I seek not to know the answers, but to understand the questions.

    thx for the feedback - Todd and Lincoln

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    ToddTodd Chief Product Officer Vanilla Staff

    Yeah that's cool. As we develop Vanilla further we'll be putting more constraints on plugin/theme development in favor of speed and consistent development. We've learned a lot over the past couple of years and now know the type of ways we need to customize Vanilla. This means that we don't have to support a lot of the theoretical options people asked for, but never used.

    Having a single css file site-wide is an optimization that has a dramatic effect on page speed. And it's something that most servers can take advantage of.

Sign In or Register to comment.