Git Product home page Git Product logo

week-6's Introduction

Week 6: Dependency Management

Install Bower

we'll do this part together

  1. Clone this project
  2. Use NPM to install Gulp, and Bower
  • bower needs to be installed globally: npm install -g bower

Use Bower for this project

we'll do this part together

  1. Initialize Bower: bower init
  2. Use Bower to install Bootstrap and jQuery
  3. Change the references to use the bower version in index.html
  • <script src="../bower_components/...

Set up Karma

our favorite part

  1. karma init
  2. Reference the bower_components versions of the vendor files
  • make sure the vendor files are the first files listed for karma and that jquery comes before bootstrap
  1. karma start
  2. Fix the inevitable errors

Set up Gulp

together

  1. Use Gulp to concat vendor js into one file
  • use a list to handle the jquery/bootstrap dependency
  1. Use Gulp to run Karma
  2. Concat and Uglify JS gulp-concat, gulp-uglify
  3. Concat and minify CSS gulp-concat, gulp-minify-css
  4. Make sure the pipe'd operations are run asynchronously, using "streams", return
  5. Copy your index (and all other html files) into the dist folder
  6. Fix references in index.html to point to the dist files
  • in reference to where the index.html will be in the dist folder

Set up a LiveReload server

together

  1. Install gulp-connect
  • var connect = require('gulp-connect');
  1. Add the following task, where "build" is the directory you put your distribution build into
gulp.task('connect', function(){
  connect.server({
    root: 'build',
    livereload: true
  });
});

You can now view your app at localhost:8080

Create some watches

do this on your own

  1. Watch all of your app's JS files and rebuild the app files when there's a change
  2. Watch all of your app's CSS files and rebuild the css files when there's a change
  3. Watch all of your app's HTML files and copy them to dist when there's a change

Add Angular to the project

do this on your own

  1. Install angular with Bower bower install angular
  2. Add the following line to your app.js:
  • `angular.module('myApp', []);
  1. Add the following attribute to the <body> tag
  • <body ng-app="myApp">

week-6's People

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.