Product first, then polish.
Get your site/application/game doing what it's supposed to do. Get it up and running, and get people interested.
Then, when you have the time, go back and polish it up. But only because you care, not because anybody else does.
Of course, if the non-compliance issues mean people can't view it, or it's unreadably ugly, or it takes a month to load, or it's hard to maintain, or it crashes the browser, this is a major problem. But it would still be a major problem even if you were standards-compliant.
Ordinary users do not look at the source for a website that isn't loading and go, "Well, it's not displaying the pictures, but it's completely W3C-compliant". They simply browse to another website and never return.
Bottom line, standards are there to make writing browsers easier, and to close up potential security holes. Amazon, Penny-Arcade and Stack Overflow do not make their money from running a standard-compliant website. And unless you're in a website-writing competition, neither will you.
I worked on a project which were very close to your situation. The requirements were the following:
- On development side, each page can have one or several JavaScript files and one or several CSS files. All those files are local.
- In production, there must be one and one only JavaScript file and one and one only CSS file. Those two files are hosted on a distant server, optimized for static files and configured for client and server side caching.
- Each page has a link to JQuery hosted at Google CDN in both development and production environments.
- The deployment process must be automated.
- The deployment process must not modify files other than JavaScript and CSS files for compression.
- The website is written in ASP.NET.
- Every page of the website uses the same CSS and the same JavaScript.
- On development side, CSS and JavaScript files are always in a specific predefined directory.
Here what was done by my colleague who worked on this part of the project.
- All files except JQuery are minified and combined into two files:
g.css
and g.js
, g
for global
. This is simply done by walking though the specific directory and searching for those files. After minifying them, the two files are send to the static content server, if they were changed since the last deployment.
- The process is executed at every build, since we couldn't find how to execute it at deployment only. It doesn't matter, after all, since it takes a few milliseconds to walk through all files and check if they were modified since the last build.
- The website is deployed as is, except the original JavaScript and CSS files. We don't need them in production.
- The masterpage (in ASP.NET) contains a specific method which is adjusting the calls to the JavaScript and CSS files depending of the context.
This method is like this:
public string MakeCssCalls(IList<string> cssFiles)
{
// ...
}
In development environment, it returned the links to CSS files inside the cssFiles
argument. In production, it ignored this argument and just returned "<link rel="stylesheet" href="http://static.example.com/g.css" type="text/css" />"
. It made the difference between production and development by comparing the machine name to the list of names in Web.config
file: some machines were configured as being development machines; all machines outside this list were assumed production servers.
Performance-wise, it would be smarter to have a different Web.config
file for production, indicating that we are actually in production (and, for example, precising the exact link to the static server with those files; in our case it was hardcoded, and that sucks). We couldn't do it this way because one of the requirements of this project was to have a single Web.config
file for all environments, but if you can, do it.
Also when is the testing generally performed? I think it should be performed on the optimized files (just in case the compressors have some bug).
We tested the website on non-minified versions of files. We never had any bug coming from Google Closure (nor our home-made crappy CSS minifier).
Best Answer
You should build a house first, then paint it.
An HTML document can stand on its own, even though it may look dull. A CSS style sheet cannot; it is nothing displayable (except as code) but instructions for display.
It’s a different issue that during painting, you may wish to do changes to the house. With real houses that’s usually not feasible, but in HTML+CSS development, it’s commonplace to notice that you need extra markup in your HTML document to make styling easier. (It’s less common than it used to be, thanks to powerful CSS3 selectors.)