Modern HTML5 Development
Total Page:16
File Type:pdf, Size:1020Kb
The Superhero’s Method of Modern HTML5 Development A RapidValue Solutions Whitepaper Contents HTML is more powerful and smart than ever before!........................................................................ 03 More tools ! More plugins !! More automations!!.............................................................................. 04 CSS Preprocessors........................................................................................................................ 05 1. Sprite images.................................................................................................................. 05 2. Susy............................................................................................................................... 05 Emmet......................................................................................................................................... 05 Scaffold with YO, build with Grunt, manage dependencies with Bower!.............................................. 06 1. Grunt............................................................................................................................. 06 2. Bower............................................................................................................................. 07 3. LiveReload...................................................................................................................... 07 4. Yeoman generators......................................................................................................... 07 Conclusion................................................................................................................................... 07 About RapidValue......................................................................................................................... 08 A Whitepaper by RapidValue Solutions - Aug 2014 02 HTML is more powerful and smart than ever before! There was a time, when we used to spend hours and hours, trying to fix the browser compatibility issues in our When everything around us UI. If problems persisted, we ended up cursing the gets smarter, its so hard for Internet Explorer at least once in a day. We were unable us to not be. to learn anything new, because nothing “new” could give a better browser support. Today, few years after the arrival of CSS3 and HTML5, things have changed for good. All the major browsers are stable and have started supporting all the essential prop- erties of CSS3 and HTML5. Things are getting more and more convenient, powerful, easy and user-friendly. A new era has started and with each passing day, the front-end developers are getting more and more enlight- ened. Yes! The developers are regarded as the ‘superhe- roes’. When everything around us is getting smarter and cooler, we cannot lag behind. The current scenario encourages you to become a front-end developer. HTML5 test score over the years 600 500 400 300 Score (points) Score 200 100 0 Jan 2009 Jan 2010 Jan 2011 Jan 2012 Jan 2013 Jan 2014 Chrome Firefox Internet Explorer Maxthon Opera Safari Source : html5test.com A Whitepaper by RapidValue Solutions - Aug 2014 0302 © RapidValue Solutions More tools ! More plugins !! More automations!! HTML5 developers have gone through many revolutions in the recent years. There has been an alarming rise in the number of innovations which has changed the notion of Being a front-end super hero who a front-end developer is and what all tasks he can is not so easy. You cannot do. just get bitten by a mutant A plethora of tools have emerged recently and have spider and start weaving the completely changed the life cycle of the HTML5 develop- web the very next morning. ment. We now have a large arsenal of tools, starting from boilerplates to performance tuning and building tools. This Its all about enables us to facilitate speed and allows us to develop in learn - practice - learn - a smarter and better way. practice and practice. Every successful front-end developer has these beneficial tools in their bag. The right usage and implementation of these tools have become critical and is considered to be becomes the superhero’s magical method of modern front-end workflow. A Whitepaper by RapidValue Solutions - Aug 2014 0402 © RapidValue Solutions CSS Preprocessors CSS isn’t that difficult to learn and its pretty easy to write, but maintenance of the CSS file has become an arduous task for the developers. The mainframe CSS preprocessor, SASS and a CSS Authoring Framework - Compass, enables writing and maintaining CSS in a much easy way as compared to the previous methods that were used. By creating cutting-edge cross browser, CSS, effort- lessly takes your style sheet to the next level, and beyond. The best part is, that you don’t need to possess knowledge like a scientist to use it. Sprite images Creating sprite images is quite challenging for all developers. Cutting the images, merging them into a single file, measuring their positions and recording that in your CSS, can be a strenuous task. This can add hours to a project and you may also need to redo it many times to get it right or in some cases, the project requirements get changed. What if someone could assist you with this? Yes, compass will do exactly that. All you need to do is to put all the images into a directory and add some basic instruc- tions. Compass will do the rest. Your work is done. Susy Susy is a Compass plugin that allows you to create a customizable grid system easily. It makes respon- sive design extremely effortless by avoiding the need to manually calculate widths. There is no need to limit the design according to the available frameworks to create responsive websites. Susy does the math for any markup, any design and any opinion. Emmet Previously known as Zen Coding, Emmet is a revolutionary editor plugin for high-speed HTML, XML, XSL and CSS coding and editing. Emmet has helped developers since many years and has now reached a new level. The core of this plugin is a powerful abbreviation engine which allows you to expand expres- sions, similar to CSS selectors, into HTML code. It will make your work seem like it has been carried out by an expert. div#page>div.logo+ul#navigation>li*3>a ...can be expanded into: <div id="page"> <div class="logo"></div> <ul id="navigation"> <li><a href=""></a></li> <li><a href=""></a></li> <li><a href=""></a></li> </ul> </div> A Whitepaper by RapidValue Solutions - Aug 2014 0502 © RapidValue Solutions Scaold with YO, build with Grunt, manage dependencies with Bower! With so many tools that are available for the front-end develop- ment, sometimes it is very difficult to figure out how these tools work together. The Yeoman workflow comprises three types of tools - the scaffolding tool (YO), the build tool (Grunt, Gulp, etc.) and the package manager (like Bower and npm) for improving your productivity and satisfaction when building a web application. Grunt Grunt is the most popular JavaScript task runner among the front-end developers. While working on a JavaScript project, there are a few things you will want to do on a regular basis. Like concatenation of the given files, running JSHint to detect errors and potential problems in your JavaScript code, running tests, or minifying and combining your scripts etc. As of now, Grunt has the following predefined tasks that you can use in your project: concat - Concatenate files init - Generate project scaffolding from a predefined template lint - Validate files with JSHint min - Minify files with UglifyJS qunit - Run QUnit unit tests in a headless PhantomJS instance server - Start a static web server test - Run unit tests with nodeunit watch - Run predefined tasks whenever watched files change In addition to the built-in tasks, you can create your own tasks. A Whitepaper by RapidValue Solutions - Aug 2014 050602 © RapidValue Solutions Bower Bower is a package manager for the web libraries. Previously when your project needed jQuery be included, you had to visit the jQuery website, download the file and move it into your project directory. Bower simplifies this process by typing bower install jquery which manages to get jQuery into your project. LiveReload LiveReload changes the way you develop. You, no longer have to save a file, switch to the browser, and then refresh the page. With LiveReload, after you save a file, the browser will refresh itself, saving your valuable and precious time. Using the dual monitor setup or a large monitor is pretty much a pre-requi- site. All you need to do is hit save and look. Yeoman generators There are quite a few Yeoman generators that are available for scaffold Web Apps (comes with SASS, Bootstrap, Modernizer, …), AngularJS apps, jQuery apps, Ember.js apps, Polymer and over 2000 more. Conclusion We are no longer completely dependent on the legacy browsers. We are taking initiatives to stretch further and develop everything that is possible with regards to the browser. By doing a lot of automation, you can avoid repeated mistakes, write in a clean and concise manner, and it becomes pretty easy to architect, maintain and extend the modular code. The life of an HTML5 developer is made pretty easy. To conclude, ‘learn-practice-learn-practice’ and prove to be beneficial to the customers. If you’d like more information on this topic, please do write to the author, Sujith Kumar K S, Senior. Front-end developer at [email protected] and our UX/UI Methodology & Design Expert, Melvin Thambi, Lead Architect - UX/UI Design at [email protected]