Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Modern Web Application Development Workflow - web2day

Modern Web Application Development Workflow - web2day

Slides of the presentation for web2day 2014

Stéphane Bégaudeau

June 06, 2014
Tweet

More Decks by Stéphane Bégaudeau

Other Decks in Programming

Transcript

  1. THROW A BUNCH OF HTML FILES ADD A COUPLE OF

    CSS FILES PUT SOME JAVASCRIPT IN ALL THIS
  2. THROW A BUNCH OF HTML FILES ADD A COUPLE OF

    CSS FILES PUT SOME JAVASCRIPT IN ALL THIS AND CALL IT A DAY...
  3. A GOOD DEVELOPMENT WORKFLOW -HELPS YOU GET STARTED -MAINTAINS YOUR

    DEPENDENCIES -ENFORCES BEST PRACTICES -PREPARES YOUR TOOLS
  4. A GOOD DEVELOPMENT WORKFLOW -HELPS YOU GET STARTED -MAINTAINS YOUR

    DEPENDENCIES -ENFORCES BEST PRACTICES -PREPARES YOUR TOOLS -FIGHTS REGRESSIONS
  5. A GOOD DEVELOPMENT WORKFLOW -HELPS YOU GET STARTED -MAINTAINS YOUR

    DEPENDENCIES -ENFORCES BEST PRACTICES -PREPARES YOUR TOOLS -FIGHTS REGRESSIONS -EASES THE RELEASE PROCESS
  6. YEOMAN scaffolding - structure - compilation - static analysis -

    dependencies management - development tools - unit testing
  7. BOWER Package manager for the web Born in 2012 Created

    by Twitter and other contributors over time
  8. BOWER Add a specific dependency > bower install jquery#1.10.2 --save

    install jquery and save this new dependency
  9. BOWER Package management always comes with its set of problems:

    - how can I create a new package? - how can I host a bower repository?
  10. BOWER Package management always comes with its set of problems:

    - how can I create a new package? - how can I host a bower repository? - what kind of exotic tools will I have to use?
  11. BOWER Host a bower repository > git init > git

    add . > git commit -m “Initial commit.”
  12. BOWER Host a bower repository > git init > git

    add . > git commit -m “Initial commit.” > git remote add origin …
  13. BOWER Host a bower repository > git init > git

    add . > git commit -m “Initial commit.” > git remote add origin … > git push origin master
  14. BOWER Host a bower repository SVN support has been added

    with bower 1.3 for those who care….
  15. BOWER Host multiple versions > git tag -a 1.4 -m

    'version 1.4' > bower install https://myrepository.git#1.4
  16. GRUNT configuration over code grunt.initConfig({ lint: { src: 'src/<%= pkg.name

    %>.js' }, concat: { src: [ '<banner:meta.banner>' , '<file_strip_banner:src/<%= pkg.name %>.js>' ], dest: '<%= pkg.name %>.js' } });
  17. GULP code over configuration gulp.src('src/main.mycss' ) .pipe(stylus()) .pipe(rename({ ext: 'css'

    })) .pipe(autoprefixer()) .pipe(cssmin()) .pipe(header( '/* All Right Reserved */' )) .pipe(gulp.dest( 'dist'))
  18. GULP Dest create a stream to the file system gulp.src('src')

    .pipe(...) .pipe(gulp.dest( 'dist'));
  19. SASS - nesting nav { ul { margin: 0; padding:

    0; list-style: none; } li { display: inline-block; } a { display: block; padding: 6px 12px; text-decoration: none; } }
  20. SASS - import - partials // base.scss @import ‘reset’; body

    { font: 100% Helvetica, sans- serif; color: #333; } // _reset.scss html, body { margin: 0; padding: 0; }
  21. SASS - mixins @mixin border-radius($radius) { -webkit-border-radius: $radius; -moz-border-radius: $radius;

    -ms-border-radius: $radius; border-radius: $radius; } .box { @include border-radius(10px); }
  22. SASS - inheritance .message { border: 1px solid #ccc; padding:

    10px; color: #333; } .success { @extend .message; border-color: green; } .error { @extend .message; border-color: red; }
  23. SASS - operators .container { width: 100%; } article[role="main"] {

    float: left; width: 600px / 960px * 100%; }
  24. UNIT TESTS Frameworks: Jasmine, Mocha, QUnit describe("A suite", function() {

    it("contains spec with an expectation", function() { expect(true).toBe(true); }); });
  25. module.exports = function(config) { config.set({ frameworks: [ 'jasmine'], singleRun: true,

    browsers: [ 'Chrome','Firefox','Safari'], files: [ '**/*.js' ], plugins: [ 'karma-jasmine' , 'karma-chrome-launcher' , 'karma-firefox-launcher' , 'karma-safari-launcher' ], exclude: [], reporters: [ 'progress'], colors: true, logLevel: config.LOG_INFO, captureTimeout: 60000 }); };
  26. PHANTOMJS Headless WebKit scriptable with JavaScript console.log('Loading a web page');

    var page = require('webpage').create(); var url = 'http://www.phantomjs.org/'; page.open(url, function (status) { //Page is loaded! phantom.exit(); });
  27. THANKS! Stéphane Bégaudeau Twitter: @sbegaudeau Google+: +stephane.begaudeau The research leading

    to these results has received funding from the European Union’s Seventh Framework Program (FP7/2007-2013) for CRYSTAL – Critical System Engineering Acceleration Joint Undertaking under grant agreement № 332830 and from specific national programs and/or funding authorities.