Git Product home page Git Product logo

angular-typescript's Introduction

init

mkdir nuProject
bower init
npm init -y

touch gulfile.js
mkdir -p public/{css,js,modules,partials}
touch public/css/style.css
touch public/js/script.js
  • public/css is to hold private css files
  • public/js is to hold private js files
  • public/modules is to hold all angular compiled js from ts
  • public/partials is to hold partial html files for angular app

TSD

tsd init
tsd install angular angular-ui-router angular-resource angular-ui-bootstrap --resolve --save

#tsd plugin
https://atom.io/packages/atom-typescript

we setup tsconfig.json to compile files ./public/modules

we also inside tsconfig.json set rootDir to './app', without this value, gulp was saving 'app/app.js' to public/modules/app/app.js conflicting with text editor

bower ui and angular files

bower install jquery bootstrap font-awesome  --save
bower install angular  --save

Gulp

gulp quick setup

npm install gulp wiredep gulp-inject --save-dev

we introduce injectAngularSrc to support injecting modules saved from typescript. name: 'angular' allows us to use <!-- angular:js --> as a place holder

  var injectAngularSrc = gulp.src('./public/modules/**/*.js',
  {read: false});
  var injectAngularOptions = {
    ignorePath: 'public',
    name: 'angular',
  };

We also introduce

var ts = require('gulp-typescript');
var tsd = require('gulp-tsd');
  • tsd allows us to compile tsd resources, since they are in .gitignore, this will come handing in production.
  • ts allows us to compile typscript to destination using same tsconfig.json, we already are able to do this via texteditor, but again, this will help at deployment.

We've been running http-server using a simple python http-server module, for consistency, we introduce, gulp-nodemon and power http-server using https://github.com/indexzero/http-server that runs http-server [path] [options]

var node = require('gulp-nodemon');

watching all files, and running on our preferred port of 8000

var Files = ['public/**/*.*', '!gulpfile.js'];
var options = {
  exec: 'node_modules/.bin/http-server',
  delayTime: 1,
  env: {
    PORT: 8000,
  },
  watch: Files,
};

gulp serve will compile all ts files, and start server, and will rerun these for any changes in /public or /app

angular-typescript's People

Contributors

kmassada avatar

Watchers

 avatar  avatar

Forkers

rljusticio

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.