locked
Unable to edit (CSS) file RRS feed

  • Question

  • User150080099 posted

    I'm getting this error:   "Unable to edit file .... The style sheet must be part of the current project and the project must be a web site or web application project." I have tried it with the CSS file defined in the Site.Master file as relative (,,/,,/xx.css) and full path (e.g. c:\....)  I get the same error in both cases and I am unable to edit the CSS file.

    Thursday, August 5, 2010 10:33 AM

Answers

  • User1224194097 posted

    Usually, it is a good practice to create a folder App_Themes and dump your css there

    Try including that css in a folder of your project and see if you are able to open and edit it.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 5, 2010 11:55 AM
  • User113076750 posted

    Actually, I'd create a new folder instead of Themes. Using themes loads all of the CSS files in the theme in every page and you don't have much control. That's okay for small projects, but we're about to de-theme our larger one - wish we had started out not using themes in the first place. Anyway, whichever works for you.


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 5, 2010 7:44 PM
  • User150080099 posted

    Thanks, guys, for your prompt follow up!  In the meantime, I got some help on another forum, a post from 2008 by Michael Jin, Microsoft.  Here's the workaround he offered and which I used successfully.  (I wish there were a fix since it was time consuming for me and I'm sure others.)

    ----------

    Hi,

    Just as you said, The problem is that the CSS is cashing on the client side and there isn’t an obvious way of telling the browser to un-cache it. But there’s a workaround to keep your CSS as fresh as your HTML.

    The trick is to pass a variable on the end of the CSS file like so:

    <link rel="stylesheet" href="http://www.abc.com/style.css?parameter=1" />

    Here, the parameter=1 indicates that the URL looks like if it’s passing a GET variable between pages. To browser, it means the page is dynamic and it needs to get a new version. The browser has no way of knowing if the CSS file is actually dynamic or not. Just change the number each time to make sure the browser always downloads the new code.

    Thanks.

    Michael Jin.
    Microsoft Online Community Support

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 5, 2010 8:43 PM

All replies

  • User1224194097 posted

    Usually, it is a good practice to create a folder App_Themes and dump your css there

    Try including that css in a folder of your project and see if you are able to open and edit it.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 5, 2010 11:55 AM
  • User113076750 posted

    Actually, I'd create a new folder instead of Themes. Using themes loads all of the CSS files in the theme in every page and you don't have much control. That's okay for small projects, but we're about to de-theme our larger one - wish we had started out not using themes in the first place. Anyway, whichever works for you.


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 5, 2010 7:44 PM
  • User150080099 posted

    Thanks, guys, for your prompt follow up!  In the meantime, I got some help on another forum, a post from 2008 by Michael Jin, Microsoft.  Here's the workaround he offered and which I used successfully.  (I wish there were a fix since it was time consuming for me and I'm sure others.)

    ----------

    Hi,

    Just as you said, The problem is that the CSS is cashing on the client side and there isn’t an obvious way of telling the browser to un-cache it. But there’s a workaround to keep your CSS as fresh as your HTML.

    The trick is to pass a variable on the end of the CSS file like so:

    <link rel="stylesheet" href="http://www.abc.com/style.css?parameter=1" />

    Here, the parameter=1 indicates that the URL looks like if it’s passing a GET variable between pages. To browser, it means the page is dynamic and it needs to get a new version. The browser has no way of knowing if the CSS file is actually dynamic or not. Just change the number each time to make sure the browser always downloads the new code.

    Thanks.

    Michael Jin.
    Microsoft Online Community Support

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 5, 2010 8:43 PM
  • User-777988094 posted

    I'm not sure of the reasoning why tacking the parameter clause on the css href gets rid of the Unable to edit error, but it most certainly works!

    Thanks!

    Friday, June 14, 2013 3:04 PM