modern frontend workflow

35
MODERN FRONTEND WORKFLOW @revathskumar

Upload: revath-s-kumar

Post on 27-Jan-2015

116 views

Category:

Software


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Modern frontend workflow

MODERN FRONTENDWORKFLOW

@revathskumar

Page 2: Modern frontend workflow

ABOUTRubyist / JavaScripterYeoman Team Member@keralarb / @keralajsWorks at @whatznearBlog at blog.revathskumar.comTwitter/Github - @revathskumar+RevathSKumar

Page 3: Modern frontend workflow

PAST : EVERYTHING WAS MANUALCreate directory structureDownload and setup js librariesMake change -> goto browser -> refresh.Compile CoffeeScript / SASS / LESSCode qualityPerformance optimizationsRunning unit tests

Page 4: Modern frontend workflow

WE NEED BETTER TOOLS TO AUTOMATE THESETASKS

Page 5: Modern frontend workflow
Page 6: Modern frontend workflow

SCAFFOLD WITH YOBUILD WITH GRUNTMANAGE DEPENDENCIES WITH BOWER

Page 7: Modern frontend workflow
Page 8: Modern frontend workflow

TASK RUNNER BASED ON CLI

Page 9: Modern frontend workflow

HUGE COMMUNITY : 2000+ PLUGINS

Page 10: Modern frontend workflow

TASKSLintTestConcatWatchMinify& many more...

Page 11: Modern frontend workflow

PACKAGE.JSON{ "name": "yeoman", "private": true, "devDependencies": { "grunt": "~0.4.1", "grunt-contrib-copy": "~0.4.1", "grunt-contrib-clean": "~0.5.0" }}

Page 12: Modern frontend workflow

GRUNTFILE . JS module.exports = function(grunt) { grunt.initConfig({ uglify: { dist: { files: { "dist/scripts/app.js": "app/scripts/*.js" } } }, clean: ['dist/*'], });

grunt.loadNpmTasks("grunt-contrib-uglify"); grunt.loadNpmTasks("grunt-contrib-clean");

grunt.registerTask('build', ['clean', 'uglify']); }

Page 13: Modern frontend workflow

BOWER

Page 14: Modern frontend workflow

PACKAGE MANAGER FOR THE WEB

Page 15: Modern frontend workflow

INSTALL & UPDATE DEPENDENCIES FROM CLIbower install jquery --save

bower update jquery

Page 16: Modern frontend workflow

BOWER.JSON{ "name": "yeoman", "version": "0.0.0", "dependencies": { "sass-bootstrap": "~3.0.0", "jquery": "~1.9.0", "underscore": "~1.4.3", "backbone": "~1.0.0", }, "devDependencies": {}}

Page 17: Modern frontend workflow
Page 18: Modern frontend workflow

Rails inspired generator system

Idea to rough prototype in 10 minutes

Page 19: Modern frontend workflow

BYPASS ALL THE REPETATIVE SETUP WORK AT THE START OFA NEW PROJECT

Page 20: Modern frontend workflow

CREATE DIRECTORY STRUCTURE

Page 21: Modern frontend workflow

/*global define*/

define([ 'underscore', 'backbone'], function (_, Backbone) { 'use strict';

var TodoModel = Backbone.Model.extend({ defaults: { } });

return TodoModel;});

BOILER PLATE YOUR CODE

Page 22: Modern frontend workflow

INSTALL DEPENDENCIES

Page 23: Modern frontend workflow

Install/Run/Update generators

Search and find generators

Use as you need

Page 24: Modern frontend workflow

WORKFLOW

Page 25: Modern frontend workflow

INSTALLATIONnpm install -g yonpm install -g grunt-clinpm install -g bower

Page 26: Modern frontend workflow

BOILERPLATEyo backbone

Page 27: Modern frontend workflow

BACKBONE GENERATOR : OPTIONS--coffee--requirejs--template-framework=handlebars--test-framework=jasmine

Page 28: Modern frontend workflow

BACKBONE SUB GENERATORSyo backbone:modelyo backbone:collectionyo backbone:routeryo backbone:view

Page 29: Modern frontend workflow

SOME OTHER GENERATORSyo chrome-extensionyo mariayo webappyo polymer& 620+ generators more

Page 30: Modern frontend workflow

RUN DEV SERVER

grunt servePreprocess CoffeeScript / SASS / LESSOpen the page in default browserWatch the folder and reload browser as you change

Page 31: Modern frontend workflow

BUILD

grunt buildLint for code qualityPreprocess CoffeeScript / SASS / LESSConcat & minifyRun the testsAssets versioning

Page 32: Modern frontend workflow

https://twitter.com/iamdevloper/status/431764751610548225

Page 33: Modern frontend workflow

REFERENCEShttp://yeoman.iohttp://gruntjs.comhttp://bower.io

Page 34: Modern frontend workflow

THANK YOU.

Page 35: Modern frontend workflow

KERALA JAVASCRIPTGroup : [email protected]

Twitter : @keralajs

keralajs.org

KERALA RUBYGroup : [email protected]

Twitter : @keralarb

krug.github.io

IRC : #krug.rb, #hackerala