Comparing stylesheets

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David

    Comparing stylesheets

    I've got a 50k main.css file that's referenced by a load of sites.
    Each of these sites also has a site.css file that modifies certain
    styles defined in main.css. Changing the colour of borders, boxes etc,
    as well as defining certain site specific styles. site.css is small
    and easy to understand, and the only bit that can be edited by the
    masses.

    That's the theory. The practice is that there are now 4 sites going
    live
    in a week where some muppet who claims to understand css has just
    copied
    main.css in chunks, renamed it site.css, tweaked some bits and added
    more, without deleting the inherited styles (*nice full explanation
    below). It all works fine, but it means each site's site.css is now
    about 60k, when it's meant to be nice and neat and about 10/20k.

    So, to the question:
    What tools do people out there use that could help me? Is there any
    tool that can compare declarations across multiple stylesheets to
    prevent me from sitting down and laboriously going through every style
    declaration in site.css to check if it's redundant or not? 4 times
    over? I've had a look at Topstyle and it doesn't seem to perform this
    function, which I find surprising. Am I being stupid?

    diff/sed/awk etc aren't options, btw...(I ain't a unix god)




    *Crystal clear explanation:


    in main.css there is this statement:

    A.backtotop:lin k, A.backtotop:vis ited {
    float:right;
    margin-top:5px;
    margin-right:10px;
    margin-left:7px;
    padding-left:10px;
    font-size:70%;
    color:#fff;
    background:url( arrow_white_up. gif) 0 0.6em no-repeat;
    }
    A.backtotop:hov er {color:#fff;}


    In site.css there is this statement:

    A.backtotop:lin k, A.backtotop:vis ited {
    float:right;
    margin-top:5px;
    margin-right:0;
    margin-left:7px;
    padding-left:10px;
    font-size:70%;
    text-decoration:none ;
    color:#000;
    background:url( arrow_black_up. gif) 0 0.6em no-repeat;
    }
    A.backtotop:hov er {text-decoration:unde rline; }


    site.css doesn't need those duplicate declarations, so that the
    declaration in site.css *should* read:

    A.backtotop:lin k, A.backtotop:vis ited {
    margin-right:0;
    text-decoration:none ;
    color:#000;
    background:url( arrow_black_up. gif) 0 0.6em no-repeat;
    }
    A.backtotop:hov er {text-decoration:unde rline; }


    But, like, there's 240k of this stuff...
  • C A Upsdell

    #2
    Re: Comparing stylesheets

    "David" <david_newz@yah oo.co.uk> wrote in message
    news:9938c22f.0 410181607.48f16 646@posting.goo gle.com...[color=blue]
    > I've got a 50k main.css file that's referenced by a load of sites.
    > Each of these sites also has a site.css file that modifies certain
    > styles defined in main.css. Changing the colour of borders, boxes etc,
    > as well as defining certain site specific styles. site.css is small
    > and easy to understand, and the only bit that can be edited by the
    > masses.
    >
    > That's the theory. The practice is that there are now 4 sites going
    > live
    > in a week where some muppet who claims to understand css has just
    > copied
    > main.css in chunks, renamed it site.css, tweaked some bits and added
    > more, without deleting the inherited styles (*nice full explanation
    > below). It all works fine, but it means each site's site.css is now
    > about 60k, when it's meant to be nice and neat and about 10/20k.
    >
    > So, to the question:
    > What tools do people out there use that could help me? Is there any
    > tool that can compare declarations across multiple stylesheets to
    > prevent me from sitting down and laboriously going through every style
    > declaration in site.css to check if it's redundant or not? 4 times
    > over? I've had a look at Topstyle and it doesn't seem to perform this
    > function, which I find surprising. Am I being stupid?[/color]

    If you made a backup before the muppet showed up, restore the files from the
    backup. Otherwise ...

    .... if you have Windows, you can try to recover the old files from the
    Recycle Bin.



    Comment

    • Lauri Raittila

      #3
      Re: Comparing stylesheets

      David wrote;[color=blue]
      > I've got a 50k main.css file that's referenced by a load of sites.[/color]

      Too heavy.
      [color=blue]
      > below). It all works fine, but it means each site's site.css is now
      > about 60k, when it's meant to be nice and neat and about 10/20k.[/color]

      Worse
      [color=blue]
      > So, to the question:
      > What tools do people out there use that could help me? Is there any
      > tool that can compare declarations across multiple stylesheets to
      > prevent me from sitting down and laboriously going through every style
      > declaration in site.css to check if it's redundant or not? 4 times
      > over? I've had a look at Topstyle and it doesn't seem to perform this
      > function, which I find surprising. Am I being stupid?
      >
      > diff/sed/awk etc aren't options, btw...(I ain't a unix god)[/color]

      Too bad... Perl?... If you can't find any tool, it might made sence to
      pay someone to do such tool, so next time such exsist. If I ahd this
      problem, I would certainly make a tool... Someone with knowledge of some
      CSS parser would make better tool.
      [color=blue]
      > in main.css there is this statement:
      >
      > A.backtotop:lin k, A.backtotop:vis ited {
      > float:right;
      > margin-top:5px;
      > margin-right:10px;
      > margin-left:7px;
      > padding-left:10px;
      > font-size:70%;
      > color:#fff;
      > background:url( arrow_white_up. gif) 0 0.6em no-repeat;
      > }
      > A.backtotop:hov er {color:#fff;}[/color]

      Easy solution: Back to top links are not good idea, so delete both and
      markup related...
      [color=blue]
      > But, like, there's 240k of this stuff...[/color]

      Hm, If I got you right, you have 4 site.css, and you need to get common
      stuff out of them to main.css? Or do you have some specific reason to
      just remove stuff in main.css from site.csses?



      --
      Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>

      Comment

      • Harlan Messinger

        #4
        Re: Comparing stylesheets


        "Lauri Raittila" <lauri@raittila .cjb.net> wrote in message
        news:MPG.1bdeeb f6dc4b366a98a06 c@news.individu al.net...[color=blue]
        > Easy solution: Back to top links are not good idea, so delete both and
        > markup related...[/color]

        That's the first time I've seen that opinion. Why aren't they a good idea?

        Comment

        • David

          #5
          Re: Comparing stylesheets

          Lauri Raittila <lauri@raittila .cjb.net> wrote in message news:<MPG.1bdee bf6dc4b366a98a0 6c@news.individ ual.net>...[color=blue][color=green]
          > > I've got a 50k main.css file that's referenced by a load of sites.[/color]
          >
          > Too heavy.[/color]


          Yeah. You're right. It's big. Lots of commonality across sites...we're
          actually going to split it up a bit so we've got a

          main.css
          sitegroup.css
          site.css

          ....sort of layout. Should reduce main to about 30k or so.

          [color=blue]
          > Too bad... Perl?... If you can't find any tool, it might made sence to
          > pay someone to do such tool, so next time such exsist. If I ahd this
          > problem, I would certainly make a tool... Someone with knowledge of some
          > CSS parser would make better tool.[/color]


          I am getting the horrible sinking feeling that it's going to be a perl
          jobby. Not *too* difficult (for someone other than me), but I was
          really hoping TopStyle had this functionality - I'm quite surprised it
          doesn't, given the nature of CSS it would seem natural that at some
          point you'd be importing multiple stylesheets into a document and have
          the possibility of duplicate styles occurring. Be a dead useful
          feature. For me. Right now. Ho hum.

          [color=blue]
          > Easy solution: Back to top links are not good idea, so delete both and
          > markup related...[/color]


          Interesting. Perhaps not the forum for it (I imagine we'd get justly
          flamed for discussing non-css stuff), but if you want to take this off
          list I'd be interested to know your reasons for saying back to top
          links aren't a good idea...it's something I've never heard before...

          [color=blue]
          > Hm, If I got you right, you have 4 site.css, and you need to get common
          > stuff out of them to main.css? Or do you have some specific reason to
          > just remove stuff in main.css from site.csses?[/color]


          Nope. I need to remove declarations in the site.css files that are
          identical to declarations in main.css...

          Comment

          • David

            #6
            Re: Comparing stylesheets

            "C A Upsdell" <cupsdell0311XX X@-@-@XXXrogers.com> wrote in message news:<hu6dnSNAI Yrh8uncRVn-ow@rogers.com>. ..[color=blue]
            >
            > If you made a backup before the muppet showed up, restore the files from the
            > backup. Otherwise ...
            >
            > ... if you have Windows, you can try to recover the old files from the
            > Recycle Bin.[/color]


            Oh, if only it were that simple :)

            The muppet has (to be honest) done a pretty extensive amount of OK
            work on the site.css files, it's just the inclusion of redundant stuff
            that's the problem.

            Comment

            • Mark Tranchant

              #7
              Re: Comparing stylesheets

              David wrote:[color=blue]
              > Lauri Raittila <lauri@raittila .cjb.net> wrote in message news:<MPG.1bdee bf6dc4b366a98a0 6c@news.individ ual.net>...[/color]
              [color=blue][color=green]
              >>Easy solution: Back to top links are not good idea, so delete both and
              >>markup related...[/color]
              >
              > Interesting. Perhaps not the forum for it (I imagine we'd get justly
              > flamed for discussing non-css stuff), but if you want to take this off
              > list I'd be interested to know your reasons for saying back to top
              > links aren't a good idea...it's something I've never heard before...[/color]

              It's a feature. We don't like features round here. ;-)

              --
              Mark.

              Comment

              • Daniel Déchelotte

                #8
                Re: Comparing stylesheets

                "Harlan Messinger" <h.messinger@co mcast.net> a écrit :

                | "Lauri Raittila" <lauri@raittila .cjb.net> wrote in message:
                |
                | > Easy solution: Back to top links are not good idea, so delete both and
                | > markup related...
                |
                | That's the first time I've seen that opinion. Why aren't they a good
                | idea?

                As a user, have you ever used one of them? Have you ever _needed_ one of
                them?

                --
                Daniel Déchelotte

                Comment

                • Alan J. Flavell

                  #9
                  Re: Comparing stylesheets

                  On Tue, 19 Oct 2004, Daniel [ISO-8859-15] Déchelotte wrote:
                  [color=blue]
                  > | "Lauri Raittila" <lauri@raittila .cjb.net> wrote in message:
                  > |
                  > | > Easy solution: Back to top links are not good idea, so delete both and
                  > | > markup related...[/color]

                  [...][color=blue]
                  >
                  > As a user, have you ever used one of them? Have you ever _needed_
                  > one of them?[/color]

                  No; but there's some kind of theory (I'd tend rather to think of it as
                  "superstiti on", I'm afraid) that they are useful for accessibility.

                  However, I don't know a browser that doesn't have several different
                  ways of its own to get to the head of the page[1], so I reckon they're
                  just a confusing waste of good markup. Those disabled folks that I've
                  met have shown much better abilities at using the browser's own
                  built-in tools on every page (rather than letting themselves be misled
                  by page-specific or site-specific ersatz features) - as compared to
                  some ordinary folks whose only "disability " was shortage of a clue.

                  cheers

                  [1] Notice that I didn't say "back to the head of the page", because a
                  reader who went to a fragment URL (wibble#whateve r) might never have
                  seen the head of the page before - hence, it can be illogical to speak
                  about going "back" to it.

                  Comment

                  • Harlan Messinger

                    #10
                    Re: Comparing stylesheets


                    "Daniel Déchelotte" <maitre_yodan@f r.club-internet.invali d> wrote in message
                    news:2004101917 2426.6d459e1e.m aitre_yodan@fr. club-internet.invali d...[color=blue]
                    > "Harlan Messinger" <h.messinger@co mcast.net> a écrit :
                    >
                    > | "Lauri Raittila" <lauri@raittila .cjb.net> wrote in message:
                    > |
                    > | > Easy solution: Back to top links are not good idea, so delete both and
                    > | > markup related...
                    > |
                    > | That's the first time I've seen that opinion. Why aren't they a good
                    > | idea?
                    >
                    > As a user, have you ever used one of them?[/color]

                    Yes, frequently.

                    Have you ever _needed_ one of[color=blue]
                    > them?[/color]

                    I don't need a mouse either--at least for web sites that build pages fully
                    accessible by keyboard--but I use one.

                    Comment

                    • Harlan Messinger

                      #11
                      Re: Comparing stylesheets


                      "Alan J. Flavell" <flavell@ph.gla .ac.uk> wrote in message
                      news:Pine.LNX.4 .61.04101916393 00.774@ppepc56. ph.gla.ac.uk...[color=blue]
                      > On Tue, 19 Oct 2004, Daniel [ISO-8859-15] Déchelotte wrote:
                      >[color=green]
                      > > | "Lauri Raittila" <lauri@raittila .cjb.net> wrote in message:
                      > > |
                      > > | > Easy solution: Back to top links are not good idea, so delete both[/color][/color]
                      and[color=blue][color=green]
                      > > | > markup related...[/color]
                      >
                      > [...][color=green]
                      > >
                      > > As a user, have you ever used one of them? Have you ever _needed_
                      > > one of them?[/color]
                      >
                      > No; but there's some kind of theory (I'd tend rather to think of it as
                      > "superstiti on", I'm afraid) that they are useful for accessibility.[/color]

                      I haven't thought of them as useful for accessibility, but for general
                      usability. Not an important feature, but a convenience.
                      [color=blue]
                      >
                      > However, I don't know a browser that doesn't have several different
                      > ways of its own to get to the head of the page[1], so I reckon they're
                      > just a confusing waste of good markup. Those disabled folks that I've
                      > met have shown much better abilities at using the browser's own
                      > built-in tools on every page (rather than letting themselves be misled
                      > by page-specific or site-specific ersatz features) - as compared to
                      > some ordinary folks whose only "disability " was shortage of a clue.
                      >
                      > cheers
                      >
                      > [1] Notice that I didn't say "back to the head of the page", because a
                      > reader who went to a fragment URL (wibble#whateve r) might never have
                      > seen the head of the page before - hence, it can be illogical to speak
                      > about going "back" to it.[/color]

                      True--and that may actually be a good reason to have these links. They alert
                      the reader to the fact, which may not otherwise have reached his attention,
                      that the place to which he has been taken is in the middle of a larger
                      page--which might contain even more useful information worth exploring.

                      Comment

                      • Darin McGrew

                        #12
                        Re: Comparing stylesheets

                        "Lauri Raittila" <lauri@raittila .cjb.net> wrote:[color=blue][color=green]
                        >> Easy solution: Back to top links are not good idea, so delete both and
                        >> markup related...[/color][/color]

                        Harlan Messinger <h.messinger@co mcast.net> wrote:[color=blue]
                        > That's the first time I've seen that opinion. Why aren't they a good idea?[/color]

                        Well, they do replicate a basic browser function (go the top of the current
                        page) that has been no more than a couple keystrokes (or mouse clicks or
                        stylus taps) away in any browser I've used. And in general, replicating
                        basic browser functions isn't a good idea.

                        But most actually reliably do what they claim to do, which is more than can
                        be said for most of the links that replicate browser functions (e.g., back,
                        close window, print).

                        So they're unnecessary at best. And in the rare case where the author
                        screws up, they're confusing when they don't actually take the user to the
                        top of the current document.
                        --
                        Darin McGrew, mcgrew@stanford alumni.org, http://www.rahul.net/mcgrew/
                        Web Design Group, darin@htmlhelp. com, http://www.HTMLHelp.com/

                        "Entering Yosemite National Park: laws of gravity strictly enforced"

                        Comment

                        • Neal

                          #13
                          Re: Comparing stylesheets

                          On Tue, 19 Oct 2004 13:08:33 -0400, Harlan Messinger
                          <h.messinger@co mcast.net> wrote:[color=blue]
                          > True--and that may actually be a good reason to have these links. They
                          > alert
                          > the reader to the fact, which may not otherwise have reached his
                          > attention,
                          > that the place to which he has been taken is in the middle of a larger
                          > page--which might contain even more useful information worth exploring.[/color]

                          If the page is long and has numerous link points throughout, it probably
                          ought to have a table of contents. "Go to table of contents" is more
                          meaningful than "Go to top", because the user might assume that they WERE
                          at the top, so why bother clicking there?

                          Comment

                          • Harlan Messinger

                            #14
                            Re: Comparing stylesheets


                            "Neal" <neal413@yahoo. com> wrote in message
                            news:opsf4pz1jg 6v6656@news.ind ividual.net...[color=blue]
                            > On Tue, 19 Oct 2004 13:08:33 -0400, Harlan Messinger
                            > <h.messinger@co mcast.net> wrote:[color=green]
                            > > True--and that may actually be a good reason to have these links. They
                            > > alert
                            > > the reader to the fact, which may not otherwise have reached his
                            > > attention,
                            > > that the place to which he has been taken is in the middle of a larger
                            > > page--which might contain even more useful information worth exploring.[/color]
                            >
                            > If the page is long and has numerous link points throughout, it probably
                            > ought to have a table of contents. "Go to table of contents" is more
                            > meaningful than "Go to top", because the user might assume that they WERE
                            > at the top, so why bother clicking there?[/color]

                            If you're a user and you see a link that tells you "Go to top", you know
                            instantly that you're not already at the top, and it no longer matters if
                            you didn't know it a moment earlier.

                            Comment

                            • Neal

                              #15
                              Re: Comparing stylesheets

                              On Tue, 19 Oct 2004 14:18:13 -0400, Harlan Messinger
                              <h.messinger@co mcast.net> wrote:
                              [color=blue]
                              >
                              > "Neal" <neal413@yahoo. com> wrote in message
                              > news:opsf4pz1jg 6v6656@news.ind ividual.net...[color=green]
                              >> If the page is long and has numerous link points throughout, it probably
                              >> ought to have a table of contents. "Go to table of contents" is more
                              >> meaningful than "Go to top", because the user might assume that they
                              >> WERE
                              >> at the top, so why bother clicking there?[/color]
                              >
                              > If you're a user and you see a link that tells you "Go to top", you know
                              > instantly that you're not already at the top, and it no longer matters if
                              > you didn't know it a moment earlier.[/color]

                              What I mean is this:

                              I click a link and I get this:

                              ---------- top of viewport ----------
                              This is the information I linked to.

                              Paragraph paragraph paragraph, I need
                              to scroll down to get to the bottom.

                              This is the last paragraph.

                              _Go to top_

                              Now, I'm thinking this link will merely bring me to the starting point I
                              was at up the page a bit, which as far as I knew was the top. In fact, it
                              will bring me to a region of the page I don't even know existed.

                              If the link read _Go to table of contents_, well, I know I haven't seen
                              that. It's worth it to me to click here.

                              Comment

                              Working...