From reading the title of this post you might assume that I am about to talk about what I do every day and have always done. You are only partly right.
The specific topic I am interested in is the building of completely flat websites. That is to say the type of delivery to a client which is made up of HTML, CSS and JavaScript that will never be integrated into a back-end, never have any other coding wrapped around it but will be kept as a series of flat pages.
This is something I have had to do recently for the first time in some time and the question of how to achieve such a thing in an elegant manner keeping the trials of development to a minimum occupies some of my time now.
What I did in this instance was use server side includes to include all the common components of each page from a central resource - this includes things like global navigation, a footer etc etc. When it came time to send the code to the client, I then ran an ANT script (as supplied by the esteemed Mr Alexander, once more a colleague) to output the flat pages.
This seemed to work well for me. However, I was not happy with the way this worked for the CSS and JavaScript code.
During development, I wanted the CSS and JavaScript code broken down into many files to help me find where code was, organise new code and bug fix. I wanted the convenience of loading Firebug and being able to see exactly where my style declarations came from on any particular node.
For the final delivery, I wanted one CSS file and just a few JavaScript files. But how to make that happen without breaking my ideals during development? Well, I could end up using ANT to piece it all together just like the HTML code. But that felt a bit messy and frankly, hand crafting XML is about the worst thing I can think of doing.
This is where I stop providing solutions and pose a question. How would you have prepared your build? How would you have made sure that during development you could pull in only the bits of JavaScript that should have been on each page and then built the flat files correctly? Its more complex than it at first appears....
19 November 2009
Subscribe to:
Post Comments (Atom)
11 comments:
If you can serve images from a web server using java environment, there is a solutionm: wro4j (http://code.google.com/p/wro4j/).
You can have as many css & js you want. All you have to do, is to create an xml defining resources to be merged & include a single resource in your html. This way you can benefit from both: easy of development & performance optimization.
I would use any CMS I like (I like my own CMS of course ;-) and wouldn't worry about anything else during the site development.
Once the site is ready I would mirror it into static pages using wget tool (or similar).
Then I would create a simple script that crawls the static files and optimizes them in a way required.
The optimization is up to you. You can grab the LINK tags referring to multiple CSS files and join referred CSS into one and rewrite the HTML to link joined file, the same javascripts, ...
You can even embed linked CSS/scripts/images into the HTML itself (if you are sure that modern browsers will be used then use the "data" URL scheme to embed images, css, scripts, whatever you need into the URL itself).
Depends on what is your goal and purpose of the pages. Less files (embed into one HTML) or fast pages (join external resources)...
Who knows maybe there are already some tools for this out there.
This seems to be very easy question for me so I am not sure if I really did understand your problem correctly. Did I miss something that makes it more complicated?
We cater to a Global Clientele - both big and small. Our prime focus is on procuring clients’ specifications and deliver stunning tailor-made websites that fuse great designs with smooth functionality. Our aim is to make excel each project with the best design standards.We’ve designed great websites for a rich array of clients and businesses around the world. We ensure you value for money and maximum ROI. Thanks. Web Development in India
There is no easy solution to this as you say, but it's a very important consideration to give.
It would need to be a server side 'build' on the fly which would create one JS file containing all the necessary code for the required functionality to meet Yahoo UI performance guidelines.
Take a look at "MINIFY".
It's a PHP5 app that combines multiple CSS or Javascript files, removes unnecessary whitespace and comments, and serves them with gzip encoding and optimal client-side cache headers.
http://code.google.com/p/minify/
Java Platform, Enterprise Edition (Java EE) is the industry-standard platform for building enterprise-class applications coded in the Java programming language. Based on the solid foundation of Java Platform, Standard Edition (Java SE), Java EE adds libraries and system services that support the scalability, accessibility, security, integrity, and other requirements of enterprise-class applications. java software company
Thanks for your post and welcome to check: here.
thanks for sharing
Hi. Greetings. This post is really good and blog is really interesting. It gives good details.
Scrum Process
Cheap Cigarettes Newport 100s this kind of kind of pattern initially decides, considered the profession recent several rounds reforms " Newport Cigarettes to compete beneficially moderately " The policy inherits, as well as profession stratification plane regarding cigarette on horizontal sincere hope, we have made the following several aspect supposition, hoped that while proposed question, may provide in some kind of way for the key backbone brand next step development the reference: Whether is these brands? With " Whether is these brand "
But is not " Which brand " also has; Comes to indicate that has indicated our basic standpoint - - present's " Double 15 " the future xiny67xt, will be in the lead for a while have been in the lead. At present resides in " Double Newport Regular Cigarettes " Row, row of position before brand will be whether the future 532, 461, whether will these brands smile finally Marlboro Reds?
Very obviously, from the present profession stratification plane's policy guidance judgment, encouraged the moderate beneficial competition was still cultivates 532, 461 essential requirements and the important way, this has decided the future 532, 461 not oriented trainings, but performed superior win and the inferior wash out through the further high level's competition, was in the lead for a while does not represent is in the lead at times. At the same time, recalls a stage the brand development process, always has some to look that resembles the accident but to anticipate in the brand change, has a look at 36 kind of superior smoke the present circumstances, including many once crest of wave very vigor brand at present tough Cheap Newports, " Double 15 " The brand has not lowered one's guard regarding prospect any Newport Cigarettes Website.
thank you very nice
Post a Comment