1

I had an idea for "cheap" version control of the css of one of my sites, but am thinking it may not be a good idea. Thought I'd throw it out here in case someone has a similar idea that works better (besides real svn, etc.)

My thought was to create a main css file like "sitename.css" then use @import inside this file to connect to the most recent file with updates. I'd name these imported files by date, eg: 20101222_css.css so I'd know when the last update was applied. When I have a change, I could make my edits, drop the update in the respective location, change the @import to the new file, and viola... updated on the site.

After reading about issues with @import, such as it loading AFTER the page finishes, I'm not too keen on this now.

Any ideas of a way to implement something similar without a full blown system? I do a lot of small project work for various people and thought this method may be a simple way to keep track of things.

Thanks for any ideas/suggestions.

2
  • 3
    I was going to ask if you actually mean version control or cache control, but then decided it didn't matter - this isn't a good solution for either. Use real version control and use traffic managed headers or versioned URIs for cache control. Commented Dec 22, 2010 at 16:02
  • 2
    You should really use git or mercurial. git has great tools on Mac/Linux. Mercurial better on Windows. (IMHO) But.... depending on how you deploy your site, you could add a "build" script that swaps in your new CSS from files in your dev env. Commented Dec 22, 2010 at 16:02

3 Answers 3

5

Your idea would add additional page loads to your site for no good reason, which will be a performance hit. It would also expose your versioning to the outside world. And as you say it will suffer from slow loading speeds due to the way @import works.

But the real down-side of this technique is that it only works for CSS files. You haven't solved the problem for any other files on your site.

You seem to think it would be simpler to use than a real SVN setup, but if you end up coming up with different techniques like this for every type of file on your site, you could easily end up giving yourself more headaches than you solve.

SVN is actually quite straightforward to use. With a good GUI (try TortoiseSVN), it's so easy you almost forget its there. Seriously, use SVN. There's no need to come up with 'clever' alternatives.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks (everyone) for the suggestions. I'm not familiar too familiar with SVN, but it sounds like my time would be better spent learning the proper technique, rather than doing a hack job putting the site together. I was thinking this would be the case, but wanted to get some other users' opinions in case there WAS some logic to doing it the way I had thought... Appreciate the feedback.
1

Its not a good idea, especially if you push this into production. If you want "cheap" version control, download VisualSVN. Its free.

1 Comment

I think he meant 'cheap' as in 'less hassle' rather than 'low cost', but the answer is the same.
0

The guys at Yahoo use a technique that reminds me of what you describe:

<link rel="stylesheet" type="text/css" href="http://l.yimg.com/a/combo?arc/yui/reset_2.6.7.css&arc/yui/fonts_2.6.4.css&[....]/subfooter_0.0.12.css" />

It makes sense for them because it's a caching tecnique. They set HTTP headers so stuff never expires: if you load the site one year later and you haven't removed your browser's cache, you shouldn't need to fetch again any of the files that haven't changed.

However, it's by no means a sensible version control system. You already have a good bunch of real version control systems out there!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.