Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 21st, 2006, 8:46 AM   #1
Gumby
Newbie
 
Join Date: Mar 2006
Location: Andover, MA / Rochester, NY / Nanticoke, PA
Posts: 16
Rep Power: 0 Gumby is on a distinguished road
Send a message via AIM to Gumby
Tool to find & remove unnecessary CSS?

Does anybody know of a tool that can search your css, html, jsp, asp, etc pages and find css that is duplicated or unnecessary and flag it for you?
Gumby is offline   Reply With Quote
Old Jun 26th, 2006, 10:50 AM   #2
angry_asian
Hobbyist Programmer
 
Join Date: Jun 2006
Location: at my computer desk
Posts: 138
Rep Power: 3 angry_asian is on a distinguished road
you can make your own in C++
angry_asian is offline   Reply With Quote
Old Jun 26th, 2006, 10:59 AM   #3
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by angry_asian
you can make your own in C++
Uh, I don't think that helps a lot

Besides, so far as I can see, the problem isn't a trivial one to solve. You'd need a CSS and HTML parser just to get started.
Arevos is offline   Reply With Quote
Old Jun 26th, 2006, 11:05 AM   #4
angry_asian
Hobbyist Programmer
 
Join Date: Jun 2006
Location: at my computer desk
Posts: 138
Rep Power: 3 angry_asian is on a distinguished road
cant you make a text editor in C++ that does that?
angry_asian is offline   Reply With Quote
Old Jun 26th, 2006, 11:25 AM   #5
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 855
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
HTML TIDY is a good tool for cleaning up HTML. I don't think it works on CSS, however.
titaniumdecoy is offline   Reply With Quote
Old Jun 26th, 2006, 11:31 AM   #6
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
I've used Tidy. I think it doesn't meet the OP's desires. He is out to find and remove duplicate or unnecessary stuff, not just correct poorly written code. How one defines "unnecessary" is obviously a factor. Even so, as Arevos mentions, it wouldn't be a trivial process. I'd rather ask if someone knows of one, than write it.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jun 26th, 2006, 11:53 AM   #7
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by angry_asian
cant you make a text editor in C++ that does that?
You can potentially make it in any language. It would just be a lot of hard work, and presumably that's something Gumby wanted to avoid in the first place.

I don't think C++ would be a very good language to write it, however. It doesn't particularly matter if a parser takes 100ms or 10'000ms, and efficiency is really C++'s only advantage over other languages that may be better suited for the task. Knowing when to use a language is rather important, and C++ doesn't seem like the right tool for the job in this case.

Java has a lot of libraries revolving around XML DOMs, and I ran across CSSEngine for Python, which looks interesting. Javascript may also be a possibility, as you can take advantage of the browser's DOM parsing without extra libraries.

However, the most efficient solution may be to do it all manually. Or find a program that already does what you need.
Arevos is offline   Reply With Quote
Old Jun 26th, 2006, 12:13 PM   #8
melbolt
Hobbyist Programmer
 
melbolt's Avatar
 
Join Date: Feb 2005
Location: PA, USA
Posts: 242
Rep Power: 4 melbolt is on a distinguished road
Send a message via AIM to melbolt Send a message via Yahoo to melbolt
maybe try visual studio.

I don't know how it works on CSS but for HTML you can go into the options and make it very anal about your code, check to make sure it meets certain standards, it will pick out every little potential wrongdoing if you set it to do so.
__________________
I have never let my schooling interfere with my education. -Mark Twain-

Xbox live gamertag: melbolt
melbolt is offline   Reply With Quote
Old Jun 26th, 2006, 2:47 PM   #9
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Again, it isn't about wrong or dirty code. It's about duplicate, unnecessary code. One might be defining the style of the "blah" class forty-leben times, all quite beautifully.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jun 28th, 2006, 9:35 AM   #10
Gumby
Newbie
 
Join Date: Mar 2006
Location: Andover, MA / Rochester, NY / Nanticoke, PA
Posts: 16
Rep Power: 0 Gumby is on a distinguished road
Send a message via AIM to Gumby
Quote:
Originally Posted by Arevos
...
However, the most efficient solution may be to do it all manually.
...
Pretty much what I've been doing anyway. It's not really too big of a deal though, it's just that every so often while looking through the HTML / CSS files I catch extra stuff that's not needed, and I just figured it'd be nice if there was something to just catch it all automatically, instead of finding little things here or there, or sitting down and searching through 30 files manually. :eek:
Gumby is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:14 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC