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

frontendtools

 frontendtools

Efficient frontend tools

Avatar for Denis Kolesnikov

Denis Kolesnikov

November 20, 2014

Other Decks in Programming

Transcript

  1. <!DOCTYPE HTML PUBLIC "-//W3 Organization//DTD W3 HTML 2.0//EN"> <HTML> <HEAD>

    <TITLE> A sample HTML document </TITLE> </HEAD> <BODY> <H1> An Example of Structure <br> In HTML </H1> <P> Here's a typical paragraph. <UL> <LI> Item one has an <A NAME="anchor"> anchor </A> <LI> Here's item two. </UL> </BODY> </HTML>
  2. IDE

  3. user@localhost ~ $ learn to use cli user@localhost ~ $

    git user@localhost ~ $ npm user@localhost ~ $ grunt user@localhost ~ $ bower
  4. – Билл Гейтс «Чтобы облегчить тяжёлую работу, поручи её ленивому,

    и он найдёт способ её упростить и облегчить».
  5. SASS $col: 40px; @mixin button-link($color) { display: block; height: 20px;

    line-height: 20px; padding: 0 20px 0 20px; background: $color; } ul { list-style: none; &.nav { width: $col * 12; li { float: left; a { @include button-link(#ccc); } } } }
  6. COMPILED CSS ul { list-style: none; } ul.nav { width:

    480px; } ul.nav li { float: left; } ul.nav li a { display: block; height: 20px; line-height: 20px; padding: 0 20px 0 20px; background: #ccc; }
  7. MINIFICATION 'use strict'; $(document).ready(function() { var validator = { error:

    '', forms: $('form'), validate: function() { var self = this; this.forms.each(function() { self.error = $(this).find('input').val() || 'Error!'; }); return self.error; } }; $('p.debug').text(validator.validate()); });
  8. module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), concat: { options:

    { separator: ';' }, dist: { src: ['src/**/*.js'], dest: 'dist/<%= pkg.name %>.js' } } }); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.registerTask('test', ['concat']); grunt.registerTask('default', ['concat']); }; var gulp = require('gulp'); // include plug-ins var jshint = require('gulp-jshint'); // JS hint task gulp.task('jshint', function() { gulp.src('./src/scripts/*.js') .pipe(jshint()) .pipe(jshint.reporter('default')); });
  9. LINTER (function() { var a = 'some string'; var b

    = 123; var c = true; })(); (function() { var a = 'some string', b = 123 c = true; })(); ,
  10. LINTER var func = function() { return { someProp: 'someString',

    someMethod: function() { console.log(this.someProp); } } }
  11. CODE STYLE • JSCS - JavaScript Code Style • Дисциплинирует

    • Стандартизирует • Способствует командной работе
  12. CSS (SCSS) CODESTYLE ul { list-style: none; &.nav { width:

    20px; li { float: left; font-family: Arial, sans-serif; margin-right: 20px; margin-left: 20px; a { @include inline-block; text-decoration: none; display: block; padding-left: 20px; padding-right: 20px; } } } }
  13. CSS (SCSS) CODESTYLE ul { list-style: none; &.nav { width:

    20px; li { font-family: Arial, sans-serif; float: left; margin-right: 20px; margin-left: 20px; a { display: block; padding-right: 20px; padding-left: 20px; text-decoration: none; @include inline-block; } } } }
  14. ХРАНЕНИЕ БИБЛИОТЕК • Content Delivery Network • Качаем прямо в

    папку с проектом • Качаем в специальную папку с библиотеками • GitHub
  15. РАЗДЕЛЯЙ И ВЛАСТВУЙ • Модульный подход • Структурированный код •

    Не используется глобальное пространство имен • Быстрый рендер страниц • Нет «лишнего» кода
  16. SVG • Мало весит • Масштабируется • Легко эмбедится в

    base64 • Можно организовать фоллбек на png